AuthorizeUtil.authorizeManageAdminGroup(context, collection); request.setAttribute("admin_create_button", Boolean.TRUE); AuthorizeUtil.authorizeRemoveAdminGroup(context, collection); request.setAttribute("admin_remove_button", Boolean.TRUE); AuthorizeUtil.authorizeManageSubmittersGroup(context, collection); request.setAttribute("submitters_button", Boolean.TRUE); AuthorizeUtil.authorizeManageWorkflowsGroup(context, collection); request.setAttribute("workflows_button", Boolean.TRUE); AuthorizeUtil.authorizeManageTemplateItem(context, collection); request.setAttribute("template_button", Boolean.TRUE); AuthorizeUtil.authorizeManageCollectionPolicy(context, collection); request.setAttribute("policy_button", Boolean.TRUE);
switch (rp.getdSpaceObject().getType()) { case Constants.BITSTREAM: authorizeManageBitstreamPolicy(c, (Bitstream) rp.getdSpaceObject()); break; case Constants.BUNDLE: authorizeManageBundlePolicy(c, (Bundle) rp.getdSpaceObject()); break; authorizeManageItemPolicy(c, (Item) rp.getdSpaceObject()); break; case Constants.COLLECTION: authorizeManageCollectionPolicy(c, (Collection) rp.getdSpaceObject()); break; case Constants.COMMUNITY: authorizeManageCommunityPolicy(c, (Community) rp.getdSpaceObject()); break; requireAdminRole(c); break;
AuthorizeUtil.authorizeManageAdminGroup(context, community); request.setAttribute("admin_create_button", Boolean.TRUE); AuthorizeUtil.authorizeRemoveAdminGroup(context, community); request.setAttribute("admin_remove_button", Boolean.TRUE); AuthorizeUtil.authorizeManageCommunityPolicy(context, community); request.setAttribute("policy_button", Boolean.TRUE);
AuthorizeUtil.authorizeManageCCLicense(context, item); try AuthorizeUtil.authorizeManageItemPolicy(context, item); request.setAttribute("policy_button", Boolean.TRUE); AuthorizeUtil.authorizeManageCCLicense(context, item); request.setAttribute("cclicense_button", Boolean.TRUE); AuthorizeUtil.authorizeManageBundlePolicy(context, item.getBundles("ORIGINAL")[0]); request.setAttribute("reorder_bitstreams_button", Boolean.TRUE); AuthorizeUtil.authorizeWithdrawItem(context, item); request.setAttribute("withdraw_button", Boolean.TRUE); AuthorizeUtil.authorizeReinstateItem(context, item); request.setAttribute("reinstate_button", Boolean.TRUE);
AuthorizeUtil.authorizeManageAdminGroup(context, newCollection); request.setAttribute("admin_create_button", Boolean.TRUE); AuthorizeUtil.authorizeManageSubmittersGroup(context, newCollection); request.setAttribute("submitters_button", Boolean.TRUE); AuthorizeUtil.authorizeManageWorkflowsGroup(context, newCollection); request.setAttribute("workflows_button", Boolean.TRUE); AuthorizeUtil.authorizeManageTemplateItem(context, newCollection); request.setAttribute("template_button", Boolean.TRUE);
AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection); tableRow.addCell().addXref(baseURL + "&submit_edit_admin", admins.getName()); AuthorizeUtil.authorizeRemoveAdminGroup(context, thisCollection); tableRow.addCell().addButton("submit_delete_admin").setValue(T_delete); try AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection); tableRow.addCell().addButton("submit_create_admin").setValue(T_create); try AuthorizeUtil.authorizeManageSubmittersGroup(context, thisCollection); if (submitters != null) AuthorizeUtil.authorizeManageCollectionPolicy(context, thisCollection);
AuthorizeUtil.authorizeManagePolicy(context, policy); AuthorizeUtil.authorizeManageCommunityPolicy(context, (Community)policyParent); break; AuthorizeUtil.authorizeManageCollectionPolicy(context, (Collection)policyParent); break; AuthorizeUtil.authorizeManageItemPolicy(context, (Item) policyParent); break; AuthorizeUtil.authorizeManageItemPolicy(context, (Item) (policyParent.getParentObject())); break; .authorizeManageItemPolicy(context, (Item) (policyParent .getParentObject())); break;
try AuthorizeUtil.authorizeManageItemPolicy(context, item); itemInfo.addItem().addButton("submit_authorization").setValue(T_submit_authorizations); try AuthorizeUtil.authorizeWithdrawItem(context, item); itemInfo.addItem().addButton("submit_withdraw").setValue(T_submit_withdraw); try AuthorizeUtil.authorizeReinstateItem(context, item); itemInfo.addItem().addButton("submit_reinstate").setValue(T_submit_reinstate);
int resourceID, String [] collectionIDs) throws NumberFormatException, SQLException, AuthorizeException AuthorizeUtil.requireAdminRole(context); FlowResult result = new FlowResult();
@Override public void removeAdministrators(Context context, Community community) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin of the parent community (or system admin) to delete Admin group AuthorizeUtil.authorizeRemoveAdminGroup(context, community); // just return if there is no administrative group. if (community.getAdministrators() == null) { return; } // Remove the link to the community table. community.setAdmins(null); }
@Override public void removeSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin to delete Submitters Group AuthorizeUtil.authorizeManageSubmittersGroup(context, collection); // just return if there is no administrative group. if (collection.getSubmitters() == null) { return; } // Remove the link to the collection table. collection.setSubmitters(null); }
@Override public Group createWorkflowGroup(Context context, Collection collection, int step) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin to create Workflow Group AuthorizeUtil.authorizeManageWorkflowsGroup(context, collection); if (getWorkflowGroup(collection, step) == null) { //turn off authorization so that Collection Admins can create Collection Workflow Groups context.turnOffAuthorisationSystem(); Group g = groupService.create(context); context.restoreAuthSystemState(); groupService.setName(g, "COLLECTION_" + collection.getID() + "_WORKFLOW_STEP_" + step); groupService.update(context, g); setWorkflowGroup(context, collection, step, g); } return getWorkflowGroup(collection, step); }
@Override public Group createAdministrators(Context context, Community community) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin to create more Admins AuthorizeUtil.authorizeManageAdminGroup(context, community); Group admins = community.getAdministrators(); if (admins == null) { //turn off authorization so that Community Admins can create Sub-Community Admins context.turnOffAuthorisationSystem(); admins = groupService.create(context); context.restoreAuthSystemState(); groupService.setName(admins, "COMMUNITY_" + community.getID() + "_ADMIN"); groupService.update(context, admins); } authorizeService.addPolicy(context, community, Constants.ADMIN, admins); // register this as the admin group community.setAdmins(admins); return admins; }
/** * Is allowed manage (create, remove, edit) bundle's policies in the * current context? * * @param context the DSpace Context Object * @param bundle the bundle that the policy refer to * @throws AuthorizeException if authorization error * if the current context (current user) is not allowed to * manage the bundle's policies * @throws SQLException if database error * if a db error occur */ public static void authorizeManageBundlePolicy(Context context, Bundle bundle) throws AuthorizeException, SQLException { Item item = bundle.getItems().get(0); authorizeManageItemPolicy(context, item); }
AuthorizeUtil.authorizeWithdrawItem(context, item);
@Override public void reinstate(Context context, Item item) throws SQLException, AuthorizeException { AuthorizeUtil.authorizeReinstateItem(context, item);
AuthorizeUtil.authorizeManageAdminGroup(context, thisCommunity); tableRow.addCell().addXref(baseURL + "&submit_edit_admin", admins.getName()); AuthorizeUtil.authorizeRemoveAdminGroup(context, thisCommunity); tableRow.addCell().addButton("submit_delete_admin").setValue(T_delete); try AuthorizeUtil.authorizeManageAdminGroup(context, thisCommunity); commAdminCell.addButton("submit_create_admin").setValue(T_create); AuthorizeUtil.authorizeManageCommunityPolicy(context, thisCommunity);
throws NumberFormatException, SQLException, AuthorizeException AuthorizeUtil.requireAdminRole(context); FlowResult result = new FlowResult();
@Override public void removeAdministrators(Context context, Collection collection) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin of the parent community to delete Admin Group AuthorizeUtil.authorizeRemoveAdminGroup(context, collection); Group admins = collection.getAdministrators(); // just return if there is no administrative group. if (admins == null) { return; } // Remove the link to the collection table. collection.setAdmins(null); }
@Override public Group createSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin to create Submitters Group AuthorizeUtil.authorizeManageSubmittersGroup(context, collection); Group submitters = collection.getSubmitters(); if (submitters == null) { //turn off authorization so that Collection Admins can create Collection Submitters context.turnOffAuthorisationSystem(); submitters = groupService.create(context); context.restoreAuthSystemState(); groupService.setName(submitters, "COLLECTION_" + collection.getID() + "_SUBMIT"); groupService.update(context, submitters); } // register this as the submitter group collection.setSubmitters(submitters); authorizeService.addPolicy(context, collection, Constants.ADD, submitters); return submitters; }