@Override public ActionForward editRoles( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PermissionsForm permissionsForm = (PermissionsForm) form; PermissionsHelperBase permissionsHelper = permissionsForm.getPermissionsHelper(); int lineNum = getLineNum(request); User user = permissionsHelper.getUsers().get(lineNum); /* * Create an Edit Roles BO that will be used by the form for setting * the boolean flags for the roles. */ PermissionsUserEditRoles editRoles = new PermissionsUserEditRoles(); editRoles.setLineNum(lineNum); editRoles.setJavaScriptEnabled(isJavaScriptEnabled(request)); editRoles.setUserName(user.getPerson().getUserName()); editRoles.setPrinipalInvestigator( isPrincipalInvestigator( (ProtocolDocument) permissionsForm.getDocument(), user.getPerson().getPersonId())); List<PermissionsRoleState> roleStates = new ArrayList<PermissionsRoleState>(); List<Role> roles = permissionsHelper.getNormalRoles(); for (Role role : roles) { if (RoleConstants.VIEWER.equalsIgnoreCase(role.getDisplayName()) || RoleConstants.AGGREGATOR.equalsIgnoreCase(role.getDisplayName()) || role.getDisplayName().equalsIgnoreCase(MAINTAIN_IRB_QUESTIONNAIRE) || role.getDisplayName().equalsIgnoreCase(PROTOCOL_DELETER)) { PermissionsRoleState roleState = new PermissionsRoleState(role); roleStates.add(roleState); } } editRoles.setRoleStates(roleStates); /* * Initialize the Edit Roles BO to the roles that the user is currently assigned to. */ List<Role> userRoles = user.getRoles(); for (Role userRole : userRoles) { editRoles.setRoleState(userRole.getName(), Boolean.TRUE); } permissionsHelper.setUserEditRoles(editRoles); return mapping.findForward(Constants.MAPPING_PERMISSIONS_EDIT_ROLES_PAGE); }
/** * Get the user's role name in the proposal. * * @return the user's role name in the proposal. */ public String getRoleLabel() { if (RoleConstants.UNASSIGNED.equals(roleName)) { return "unassigned"; } else if (RoleConstants.AGGREGATOR.equals(roleName)) { return "Aggregator"; } else if (RoleConstants.BUDGET_CREATOR.equals(roleName)) { return "Budget Creator"; } else if (RoleConstants.NARRATIVE_WRITER.equals(roleName)) { return "Narrative Writer"; } else if (RoleConstants.VIEWER.equals(roleName)) { return "Viewer"; } else { return ""; } }