Package org.dspace.authorize

Examples of org.dspace.authorize.AuthorizeException


    WorkflowItem workflowItem = findWorkflow(context, id);
        if(workflowItem.getState() != WorkflowManager.WFSTATE_STEP1POOL &&
                workflowItem.getState() != WorkflowManager.WFSTATE_STEP2POOL &&
                workflowItem.getState() != WorkflowManager.WFSTATE_STEP3POOL){
            // Only allow tasks in the pool to be claimed !
            throw new AuthorizeException("Error while claiming task: this task has already been claimed !");
        }

       // Claim the task
       WorkflowManager.claim(context, workflowItem, context.getCurrentUser());
View Full Code Here


    public static void authorizeWorkflowItem(Context context, String workflowItemId) throws AuthorizeException, SQLException {
        WorkflowItem workflowItem = WorkflowItem.find(context, Integer.parseInt(workflowItemId.substring(1)));
        if((workflowItem.getState() == WorkflowManager.WFSTATE_STEP1 ||
                workflowItem.getState() == WorkflowManager.WFSTATE_STEP2 ||
                workflowItem.getState() == WorkflowManager.WFSTATE_STEP3) && workflowItem.getOwner().getID() != context.getCurrentUser().getID()){
            throw new AuthorizeException("You are not allowed to perform this task.");
        }else
        if((workflowItem.getState() == WorkflowManager.WFSTATE_STEP1POOL ||
                workflowItem.getState() == WorkflowManager.WFSTATE_STEP2POOL ||
                workflowItem.getState() == WorkflowManager.WFSTATE_STEP3POOL)){
            // Verify if the current user has the current workflowItem among his pooled tasks
            boolean hasPooledTask = false;
            List<WorkflowItem> pooledTasks = WorkflowManager.getPooledTasks(context, context.getCurrentUser());
            for (WorkflowItem pooledItem : pooledTasks) {
                if(pooledItem.getID() == workflowItem.getID()){
                    hasPooledTask = true;
                }
            }
            if(!hasPooledTask){
                throw new AuthorizeException("You are not allowed to perform this task.");
            }

        }
    }
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

    @Override
    public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
        Request request = ObjectModelHelper.getRequest(objectModel);
        Context context = ContextUtil.obtainContext(request);
        if(!AuthorizeManager.isAdmin(context)){
            throw new AuthorizeException();
        }

        XmlWorkflowItem xmlWorkflowItem = retrieveWorkflowItem(request, context);
        String actionURL = contextPath + "/admin/display-workflowItem";
View Full Code Here

    {
        new NonStrictExpectations(AuthorizeManager.class)
        {{
            // Disallow Item ADD perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                    Constants.ADD); result = new AuthorizeException();

        }};

        String name = "bundle";
        Bundle created = it.createBundle(name);
View Full Code Here

    {
        new NonStrictExpectations(AuthorizeManager.class)
        {{
            // Disallow Item ADD perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                    Constants.ADD); result = new AuthorizeException();

        }};

        String name = "bundle";
        Bundle created = Bundle.create(context);
View Full Code Here

            // Allow Item ADD perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                    Constants.ADD); result = null;
            // Disallow Item REMOVE perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                    Constants.REMOVE); result = new AuthorizeException();
        }};

        String name = "bundle";
        Bundle created = Bundle.create(context);
        created.setName(name);
View Full Code Here

    {
        new NonStrictExpectations(AuthorizeManager.class)
        {{
            // Disallow Item ADD perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                    Constants.ADD); result = new AuthorizeException();

        }};

        String name = "new bundle";
        File f = new File(testProps.get("test.bitstream").toString());
View Full Code Here

    {
        new NonStrictExpectations(AuthorizeManager.class)
        {{
            // Disallow Item ADD perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                    Constants.ADD); result = new AuthorizeException();

        }};

        File f = new File(testProps.get("test.bitstream").toString());
        Bitstream result = it.createSingleBitstream(new FileInputStream(f));
View Full Code Here

            // Allow Item ADD perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                   Constants.ADD); result = null;
            // Disallow Item REMOVE perms
            AuthorizeManager.authorizeAction((Context) any, (Item) any,
                    Constants.REMOVE); result = new AuthorizeException();
        }};

        String name = "LICENSE";
        Bundle created = Bundle.create(context);
        created.setName(name);
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.