94,7 → 94,10 |
|
initUserList(request, user); |
request.setAttribute("u", u); |
return mapping.findForward("default"); |
if(u.editableBy(user)) |
return mapping.findForward("default"); |
else |
return mapping.findForward("view"); |
} |
else if("delete".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
102,8 → 105,10 |
User u = UserManager.getInstance().get(user, userId); |
request.setAttribute("u", u); |
|
if(u.equals(user)) |
if(u.equals(user)) { |
handleErrors(mapping, form, request, response); |
throw new UserException(CoreResources.DELETE_ME_SELF); |
} |
|
// FIXME: invalidate session of deleted user if it is logged in |
// FIXME: if two admins delete each other at the same time |
119,8 → 124,10 |
String password = (String)theForm.get("password"); |
|
if(userId == null) { |
if(password == null || password.equals("")) |
if(password == null || password.equals("")) { |
handleErrors(mapping, form, request, response); |
throw new UserException(CoreResources.PASSWORD_REQUIRED); |
} |
|
u = UserManager.getInstance().create(user); |
} |
129,7 → 136,12 |
} |
request.setAttribute("u", u); |
|
u.setLogin(user, (String)theForm.get("login")); |
String login = (String)theForm.get("login"); |
if(UserManager.getInstance().loginExists(user, u, login)) { |
handleErrors(mapping, form, request, response); |
throw new UserException(CoreResources.NONUNIQUE_USER_LOGIN); |
} |
u.setLogin(user, login); |
|
if(u.editableBy(user)) { |
Long bossId = StringConverter.parseLong(theForm.get("boss")); |