Package org.dspace.xmlworkflow

Examples of org.dspace.xmlworkflow.Role


    }
        return roleGroup;
    }
   
    private static Group getXMLWorkflowRole(Context context, int collectionID, String roleName, Collection collection, Group roleGroup) throws IOException, WorkflowConfigurationException, SQLException, AuthorizeException {
        Role role = WorkflowUtils.getCollectionAndRepositoryRoles(collection).get(roleName);
        if(role.getScope() == Role.Scope.COLLECTION || role.getScope() == Role.Scope.REPOSITORY){
            roleGroup = WorkflowUtils.getRoleGroup(context, collectionID, role);
            if(roleGroup == null){
                AuthorizeManager.authorizeAction(context, collection, Constants.WRITE);
                roleGroup = Group.create(context);
                if(role.getScope() == Role.Scope.COLLECTION){
                    roleGroup.setName("COLLECTION_" + collection.getID() + "_WORKFLOW_ROLE_" + roleName);
                }else{
                    roleGroup.setName(role.getName());
                }
                roleGroup.update();
                AuthorizeManager.addPolicy(context, collection, Constants.ADD, roleGroup);
                if(role.getScope() == Role.Scope.COLLECTION){
                    WorkflowUtils.createCollectionWorkflowRole(context, collectionID, roleName, roleGroup);
                }
           }
        }
        return roleGroup;
View Full Code Here


    private void addXMLWorkflowRoles(Collection thisCollection, String baseURL, HashMap<String, Role> roles, Table rolesTable) throws WingException, SQLException {
        Row tableRow;
        if(roles != null){
            //ROLES: show group name instead of role name
            for(String roleId: roles.keySet()){
                Role role = roles.get(roleId);

                if (role.getScope() == Role.Scope.COLLECTION || role.getScope() == Role.Scope.REPOSITORY) {
                    tableRow = rolesTable.addRow(Row.ROLE_DATA);
                    tableRow.addCell(Cell.ROLE_HEADER).addContent(role.getName());
                    Group roleGroup = WorkflowUtils.getRoleGroup(context, thisCollection.getID(), role);
                    if (roleGroup != null) {
                        if(role.getScope() == Role.Scope.REPOSITORY){
                            if(AuthorizeManager.isAdmin(context)){
                                tableRow.addCell().addXref(baseURL + "&submit_edit_wf_role_" + roleId, roleGroup.getName());
                            }else{
                                Cell cell = tableRow.addCell();
                                cell.addContent(roleGroup.getName());
                                cell.addHighlight("fade").addContent(T_sysadmins_only_repository_role);
                            }
                        }else{
                            tableRow.addCell().addXref(baseURL + "&submit_edit_wf_role_" + roleId, roleGroup.getName());
                        }

                        if (role.getScope() == Role.Scope.COLLECTION) {
                            addAdministratorOnlyButton(tableRow.addCell(), "submit_delete_wf_role_" + roleId, T_delete);
                        } else {
                            tableRow.addCell();
                        }
                    } else {
                        tableRow.addCell().addContent(T_no_role);
                        if (role.getScope() == Role.Scope.COLLECTION || role.getScope() == Role.Scope.REPOSITORY) {
                            addAdministratorOnlyButton(tableRow.addCell(), "submit_create_wf_role_" + roleId, T_create);
                        } else {
                            tableRow.addCell();
                        }
                    }
                    // help and directions row
                    tableRow = rolesTable.addRow(Row.ROLE_DATA);
                    tableRow.addCell();
                    if (role.getDescription() != null){
                        tableRow.addCell(1,2).addHighlight("fade offset").addContent(role.getDescription());
                    }

                } else {
                    tableRow = rolesTable.addRow(Row.ROLE_DATA);
                    tableRow.addCell(Cell.ROLE_HEADER).addContent(role.getName());

                    tableRow.addCell().addContent(T_no_role);
                    tableRow.addCell();

                    // help and directions row
                    tableRow = rolesTable.addRow(Row.ROLE_DATA);
                    tableRow.addCell();
                    if (role.getDescription() != null){
                        tableRow.addCell(1,2).addHighlight("fade offset").addContent(role.getDescription());
                    }
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.dspace.xmlworkflow.Role

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.