]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/output/GroupSelector.java
Highlight expired nucleus bonus verifications in points overview
[gigi.git] / src / org / cacert / gigi / output / GroupSelector.java
index 850e1d5ac72272c1e2b4e577b4b60007fb326723..9d3080ddc1aaf3646ebc08631d6edd3553affc7e 100644 (file)
@@ -26,11 +26,13 @@ public class GroupSelector implements Outputable {
 
     public void update(HttpServletRequest r) throws GigiApiException {
         String vS = r.getParameter(name);
-        value = null;
-        for (Group g : Group.values()) {
-            if (g.getDatabaseName().equals(vS) && mayManage(g)) {
-                value = g;
-            }
+        if (vS == null) {
+            throw new GigiApiException("No value for group.");
+        }
+        try {
+            value = Group.getByString(vS);
+        } catch (IllegalArgumentException e) {
+            throw new GigiApiException("Invalid value for group.");
         }
     }
 
@@ -39,7 +41,7 @@ public class GroupSelector implements Outputable {
         out.println("<select name='" + name + "'>");
         for (Group g : Group.values()) {
             if (mayManage(g)) {
-                out.print("<option value='" + g.getDatabaseName());
+                out.print("<option value='" + g.getDBName());
                 if (g.equals(value)) {
                     out.print(" selected");
                 }