]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/admin/support/SupportUserDetailsPage.java
Clean: use "authorizationContexts"
[gigi.git] / src / org / cacert / gigi / pages / admin / support / SupportUserDetailsPage.java
index afacb56c86e3edbfda135e4aac6f2d746aace52a..b1ec3abf7bf041af50bad7260444130903075850 100644 (file)
@@ -16,6 +16,7 @@ import org.cacert.gigi.localisation.Language;
 import org.cacert.gigi.output.template.Form;
 import org.cacert.gigi.output.template.IterableDataset;
 import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.util.AuthorizationContext;
 
 public class SupportUserDetailsPage extends Page {
 
@@ -30,11 +31,7 @@ public class SupportUserDetailsPage extends Page {
         int id = -1;
         String[] idP = req.getPathInfo().split("/");
         try {
-            if (req.getPathInfo().endsWith("history") || req.getPathInfo().endsWith("trainings")) {
-                id = Integer.parseInt(idP[idP.length - 2]);
-            } else {
-                id = Integer.parseInt(idP[idP.length - 1]);
-            }
+            id = Integer.parseInt(idP[idP.length - 1]);
         } catch (NumberFormatException e) {
             resp.sendError(404);
         }
@@ -92,10 +89,7 @@ public class SupportUserDetailsPage extends Page {
     }
 
     @Override
-    public boolean isPermitted(User u) {
-        if (u == null) {
-            return false;
-        }
-        return u.isInGroup(Group.SUPPORTER);
+    public boolean isPermitted(AuthorizationContext ac) {
+        return ac != null && ac.isInGroup(Group.SUPPORTER);
     }
 }