public void addOptions(Options options) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException { /* Create skeleton menu structure to ensure consistent order between aspects, * even if they are never used */ List admin = options.addList("administrative"); //Check if a system administrator boolean isSystemAdmin = AuthorizeManager.isAdmin(this.context); // System Administrator options! if (isSystemAdmin) { admin.addItemXref(contextPath+ "/admin/xmlworkflowoverview", T_xmlworkflow_overview); } }
return AuthorizeManager.isAdmin(context);
if (AuthorizeManager.isAdmin(context))
/** * Is the authenticated user a DSpace administrator? This translates * as asking the question of whether the given eperson is a member * of the special DSpace group Administrator, with id 1 * * @param swordContext * @return true if administrator, false if not * @throws SQLException */ public boolean isUserAdmin(SWORDContext swordContext) throws DSpaceSWORDException { try { EPerson authenticated = swordContext.getAuthenticated(); if (authenticated != null) { return AuthorizeManager.isAdmin(swordContext.getAuthenticatorContext()); } return false; } catch (SQLException e) { log.error("Caught exception: ", e); throw new DSpaceSWORDException(e); } }
/** * Is the given onBehalfOf user DSpace administrator? This translates * as asking the question of whether the given eperson is a member * of the special DSpace group Administrator, with id 1 * * @param swordContext * @return true if administrator, false if not * @throws SQLException */ public boolean isOnBehalfOfAdmin(SWORDContext swordContext) throws DSpaceSWORDException { EPerson onBehalfOf = swordContext.getOnBehalfOf(); try { if (onBehalfOf != null) { return AuthorizeManager.isAdmin(swordContext.getOnBehalfOfContext()); } return false; } catch (SQLException e) { log.error("Caught exception: ", e); throw new DSpaceSWORDException(e); } }
private void addAdministratorOnlyButton(Cell cell, String buttonName, Message buttonLabel) throws WingException, SQLException { Button button = cell.addButton(buttonName); button.setValue(buttonLabel); if (!AuthorizeManager.isAdmin(context)) { // Only admins can create or delete button.setDisabled(); cell.addHighlight("fade").addContent(T_sysadmins_only); } } }
private void addCollectionAdminOnlyButton(org.dspace.app.xmlui.wing.element.Item item, Collection collection, String buttonName, Message buttonLabel) throws WingException, SQLException { Button button = item.addButton(buttonName); button.setValue(buttonLabel); if (!AuthorizeManager.isAdmin(context, collection)) { // Only admins can create or delete button.setDisabled(); item.addHighlight("fade").addContent(T_collectionadmins_only); } }
private void addAdministratorOnlyButton(Cell cell, String buttonName, Message buttonLabel) throws WingException, SQLException { Button button = cell.addButton(buttonName); button.setValue(buttonLabel); if (!AuthorizeManager.isAdmin(context)) { // Only admins can create or delete button.setDisabled(); cell.addHighlight("fade").addContent(T_sysadmins_only); } } }
public void addBody(Body body) throws SAXException, WingException, SQLException, IOException, AuthorizeException { Context context = ContextUtil.obtainContext(ObjectModelHelper.getRequest(objectModel)); if(!AuthorizeManager.isAdmin(context)){ throw new AuthorizeException(); } Division div = body.addInteractiveDivision("xmlworkflowoverview", contextPath + "/admin/xmlworkflowoverview", Division.METHOD_POST, "primary"); this.buildSearchResultsDivision(div); }
if (!AuthorizeManager.isAdmin(context) && !SystemwideAlerts.canUserStartSession())
if (!AuthorizeManager.isAdmin(context) && !SystemwideAlerts.canUserMaintainSession())
showReport = AuthorizeManager.isAdmin(context);
if (AuthorizeManager.isAdmin(context))
if (AuthorizeManager.isAdmin(context))
@Override public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception { Request request = ObjectModelHelper.getRequest(objectModel); Context context = ContextUtil.obtainContext(request); if(!AuthorizeManager.isAdmin(context)){ throw new AuthorizeException(); } int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id"); if(workflowIdentifiers != null){ for (int workflowIdentifier : workflowIdentifiers) { XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier); if (workflowItem != null) { XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null); } } } return null; } }
@Override public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception { Request request = ObjectModelHelper.getRequest(objectModel); Context context = ContextUtil.obtainContext(request); if(!AuthorizeManager.isAdmin(context)){ throw new AuthorizeException(); } int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id"); if(workflowIdentifiers != null){ for (int workflowIdentifier : workflowIdentifiers) { XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier); if (workflowItem != null) { WorkspaceItem workspaceItem = XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null); //Delete the workspaceItem workspaceItem.deleteAll(); } } } return null; } }
if (!publicise && !AuthorizeManager.isAdmin(context))
Request request = ObjectModelHelper.getRequest(objectModel); Context context = ContextUtil.obtainContext(request); if(!AuthorizeManager.isAdmin(context)){ throw new AuthorizeException();
if (AuthorizeManager.isAdmin(context))