Package org.dspace.authorize

Examples of org.dspace.authorize.AuthorizeException


            EPersonDeletionException
    {
        // authorized?
        if (!AuthorizeManager.isAdmin(ourContext))
        {
            throw new AuthorizeException(
                    "You must be an admin to delete an EPerson");
        }

        // check for presence of eperson in tables that
        // have constraints on eperson_id
View Full Code Here


            throws SQLException, AuthorizeException
    {
        if (!(AuthorizeManager.isAdmin(context) ||
              (parent != null && AuthorizeManager.authorizeActionBoolean(context, parent, Constants.ADD))))
        {
            throw new AuthorizeException(
                    "Only administrators can create communities");
        }

        TableRow row = DatabaseManager.create(context, "community");
        Community c = new Community(context, row);
View Full Code Here

            basicHost = host.substring(host.substring(0, lastDot).lastIndexOf("."));
        }

        if (fromPage == null || fromPage.indexOf(basicHost) == -1)
        {
            throw new AuthorizeException();
        }

        // The email address they provided
        String formEmail = request.getParameter("email");
View Full Code Here

            {
                userID = c.getCurrentUser().getID();
            }

            // show an error or throw an authorization exception
            throw new AuthorizeException("EditItemServlet: User " + userID
                    + " not authorized to edit item " + item.getID());
        }
    }
View Full Code Here

        {
            displayStatistics(context, request, response);
        }
        else
        {
            throw new AuthorizeException();
        }
    }
View Full Code Here

        }
     
      // Only super administrators can login as someone else.
      if (!AuthorizeManager.isAdmin(context))
        {
            throw new AuthorizeException("xmlui.utils.AuthenticationUtil.onlyAdmins");
        }
       
      // Just to be double be sure, make sure the administrator
      // is the one who actually authenticated himself.
      HttpSession session = request.getSession(false);
      Integer authenticatedID = (Integer) session.getAttribute(AUTHENTICATED_USER_ID);
      if (context.getCurrentUser().getID() != authenticatedID)
        {
            throw new AuthorizeException("xmlui.utils.AuthenticationUtil.onlyAuthenticatedAdmins");
        }
     
      // You may not assume the login of another super administrator
      if (loginAs == null)
        {
            return;
        }
      Group administrators = Group.find(context,1);
      if (administrators.isMember(loginAs))
        {
            throw new AuthorizeException("xmlui.utils.AuthenticationUtil.notAnotherAdmin");
        }
     
      // Success, allow the user to login as another user.
      context.setCurrentUser(loginAs);
 
View Full Code Here

private void assignPermissions(Context context, DSpaceObject dso, List<ResourcePolicy> policies)
        throws SQLException, AuthorizeException
    {
        AuthorizeManager.removeAllPolicies(context, dso);
        if (policies == null){
            throw new AuthorizeException("Policies are null");
        }
        else{
            AuthorizeManager.addPolicies(context, policies, dso);
        }
    }
View Full Code Here

        }
    }

    public void addBody(Body body) throws SAXException, WingException, SQLException, IOException, AuthorizeException {
        if(!authorized)
            throw new AuthorizeException("You are not authorized to perform this task");

        xmluiActionUI.addBody(body);
    }
View Full Code Here


    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);
    }
View Full Code Here

    @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) {
View Full Code Here

TOP

Related Classes of org.dspace.authorize.AuthorizeException

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.