]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/account/UserTrainings.java
Add a hint what the "Request reping" is used for on the email page
[gigi.git] / src / org / cacert / gigi / pages / account / UserTrainings.java
index 8c117d5ee53ac3216eff8891c0a65d35f140573d..fca2d24f2cf306d0d03379a781f212843a37d7cb 100644 (file)
@@ -29,6 +29,7 @@ public class UserTrainings extends Page {
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         User u;
+        HashMap<String, Object> vars = new HashMap<>();
         if (support) {
             String info = req.getPathInfo();
             int id = Integer.parseInt(info.substring(intStart, info.length() - SUPPORT_PATH.length() + intStart + 1));
@@ -37,16 +38,23 @@ public class UserTrainings extends Page {
                 resp.sendError(404);
                 return;
             }
+            vars.put("username", u.getPreferredName().toString());
         } else {
             u = getUser(req);
         }
-        HashMap<String, Object> vars = new HashMap<>();
         vars.put("entries", new OutputableArrayIterable(u.getTrainings(), "entry"));
         getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
     }
 
     @Override
     public boolean isPermitted(AuthorizationContext ac) {
-        return ac != null && ( !support || ac.canSupport());
+        if (ac == null) {
+            return false;
+        }
+        if (support) {
+            return ac.canSupport();
+        } else {
+            return ac.getTarget() instanceof User;
+        }
     }
 }