]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/Group.java
Fix error message
[gigi.git] / src / org / cacert / gigi / dbObjects / Group.java
index 287187a2d73482f5de592997a837da595c8f0827..91becaf8c84d97b518810f3281f6cd08d9b066e4 100644 (file)
@@ -1,11 +1,12 @@
 package org.cacert.gigi.dbObjects;
 
+import org.cacert.gigi.database.DBEnum;
 import org.cacert.gigi.database.GigiPreparedStatement;
 import org.cacert.gigi.database.GigiResultSet;
 import org.cacert.gigi.output.template.Outputable;
 import org.cacert.gigi.output.template.TranslateCommand;
 
-public enum Group {
+public enum Group implements DBEnum {
     SUPPORTER("supporter", "supporter", true, false, true), //
     ARBITRATOR("arbitrator", "arbitrator", true, false, true), //
     BLOCKEDASSURER("blockedassurer", "may not verify", true, false, false), //
@@ -17,7 +18,8 @@ public enum Group {
     CODESIGNING("codesigning", "may issue codesigning certificates", true, false, false), //
     ORGASSURER("orgassurer", "may verify organisations", true, false, true), //
     NUCLEUS_ASSURER("nucleus-assurer", "may enter nucleus verifications", true, false, true), //
-    LOCATE_AGENT("locate-agent", "wants access to the locate agent system", false, true, false);
+    LOCATE_AGENT("locate-agent", "wants access to the locate agent system", false, true, false), //
+    VERIFY_NOTIFICATION("verify-notification", "wants to receive an email notification for any Verification they enter", false, true, false);
 
     private final String dbName;
 
@@ -72,13 +74,9 @@ public enum Group {
         return isSelfViewable;
     }
 
-    public String getDatabaseName() {
-        return dbName;
-    }
-
     public User[] getMembers(int offset, int count) {
         try (GigiPreparedStatement gps = new GigiPreparedStatement("SELECT `user` FROM `user_groups` WHERE `permission`=?::`userGroup` AND `deleted` IS NULL OFFSET ? LIMIT ?", true)) {
-            gps.setString(1, dbName);
+            gps.setEnum(1, this);
             gps.setInt(2, offset);
             gps.setInt(3, count);
             GigiResultSet grs = gps.executeQuery();
@@ -95,7 +93,7 @@ public enum Group {
 
     public int getMemberCount() {
         try (GigiPreparedStatement gps = new GigiPreparedStatement("SELECT COUNT(`user`) FROM `user_groups` WHERE `permission`=?::`userGroup` AND `deleted` IS NULL", true)) {
-            gps.setString(1, dbName);
+            gps.setEnum(1, this);
             GigiResultSet grs = gps.executeQuery();
             if ( !grs.next()) {
                 return 0;
@@ -107,4 +105,9 @@ public enum Group {
     public Outputable getName() {
         return tc;
     }
+
+    @Override
+    public String getDBName() {
+        return dbName;
+    }
 }