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 {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- int id;
+ int id = -1;
String[] idP = req.getPathInfo().split("/");
- id = Integer.parseInt(idP[idP.length - 1]);
+ try {
+ id = Integer.parseInt(idP[idP.length - 1]);
+ } catch (NumberFormatException e) {
+ resp.sendError(404);
+ }
final User user = User.getById(id);
String ticket = (String) req.getSession().getAttribute("ticketNo" + user.getId());
SupportUserDetailsForm f = new SupportUserDetailsForm(req, new SupportedUser(user, getUser(req), ticket));
}
@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);
}
}