* @throws Exception on any error
*/
public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
PolicyUtil.checkPermission(PolicyConstants.ACCOUNTS_AND_GROUPS_RESOURCE_TYPE, PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN, request);
RoleForm roleForm = (RoleForm) form;
SessionInfo sessionInfo = getSessionInfo(request);
if (roleForm.getEditing()) {
String[] usersNotRemoved = updateRole(roleForm, sessionInfo);
if (usersNotRemoved.length != 0) {
saveError(request, "availableRoles.error.groupsRequired", Utils.commaList(usersNotRemoved));
}
} else {
createRole(roleForm, sessionInfo);
}
saveMessage(request, "availableRoles.roleCreated", roleForm.getRolename());
// we need to reset the menu items as they could have changed here.
LogonControllerFactory.getInstance().applyMenuItemChanges(request);
return cancel(mapping, form, request, response);
}