]> WPIA git - gigi.git/commitdiff
Disable PoJAM (fixes #9)
authorFelix Dörre <felix@dogcraft.de>
Thu, 9 Jun 2016 09:37:35 +0000 (11:37 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 9 Jun 2016 22:22:11 +0000 (00:22 +0200)
Change-Id: Ib37e6d52a737ada8d528278311bf2de63fad9a8e

src/org/cacert/gigi/dbObjects/User.java
tests/org/cacert/gigi/util/TestNotary.java

index e831dfcc14bd4f7b05daa530b476e3e8fe451297..b72af84fbc03eb840e82ae69f95e96bd5d503f58 100644 (file)
@@ -45,6 +45,8 @@ public class User extends CertificateOwner {
 
     public static final int ADULT_AGE = 18;
 
+    public static final boolean POJAM_ENABLED = false;
+
     protected User(GigiResultSet rs) {
         super(rs.getInt("id"));
         updateName(rs);
@@ -138,8 +140,14 @@ public class User extends CertificateOwner {
     }
 
     public boolean canAssure() {
-        if ( !CalendarUtil.isOfAge(dob, POJAM_AGE)) { // PoJAM
-            return false;
+        if (POJAM_ENABLED) {
+            if ( !CalendarUtil.isOfAge(dob, POJAM_AGE)) { // PoJAM
+                return false;
+            }
+        } else {
+            if ( !CalendarUtil.isOfAge(dob, ADULT_AGE)) {
+                return false;
+            }
         }
         if (getAssurancePoints() < 100) {
             return false;
@@ -200,7 +208,7 @@ public class User extends CertificateOwner {
      * @return the maximal points @
      */
     public int getMaxAssurePoints() {
-        if ( !CalendarUtil.isOfAge(dob, ADULT_AGE)) {
+        if ( !CalendarUtil.isOfAge(dob, ADULT_AGE) && POJAM_ENABLED) {
             return 10; // PoJAM
         }
 
index d9f190e096a5adca0ed539673b331b817bb14548..22f75b2362789c0f84c92d5608343c483ab50806 100644 (file)
@@ -85,7 +85,9 @@ public class TestNotary extends ManagedTest {
         for (int i = 0; i < users.length; i++) {
             assuranceFail(assurer, users[i], -1, "test-notary", "2014-01-01");
             assuranceFail(assurer, users[i], 11, "test-notary", "2014-01-01");
-            Notary.assure(assurer, users[i], users[i].getName(), users[i].getDoB(), 10, "test-notary", "2014-01-01", AssuranceType.FACE_TO_FACE);
+            if (User.POJAM_ENABLED) {
+                Notary.assure(assurer, users[i], users[i].getName(), users[i].getDoB(), 10, "test-notary", "2014-01-01", AssuranceType.FACE_TO_FACE);
+            }
             assuranceFail(assurer, users[i], 10, "test-notary", "2014-01-01");
         }
     }