Package com.adito.policyframework.forms

Examples of com.adito.policyframework.forms.AccessRightsForm


    public void testCreateResourceNotImplemented() {
    }
   
    @Override
    protected void updateResourceProperties(AbstractResourceForm<AccessRights> resourceForm) throws Exception {
        AccessRightsForm accessRightsForm = (AccessRightsForm) resourceForm;
        AccessRights resource = accessRightsForm.getResource();
        resource.addAccessRight(new AccessRight(resourceType, new Permission(PolicyConstants.PERM_EDIT_AND_ASSIGN_ID, "policyframework")));
        resource.addAccessRight(new AccessRight(resourceType, new Permission(PolicyConstants.PERM_DELETE_ID, "policyframework")));
    }
View Full Code Here


        resource.addAccessRight(new AccessRight(resourceType, new Permission(PolicyConstants.PERM_EDIT_AND_ASSIGN_ID, "policyframework")));
        resource.addAccessRight(new AccessRight(resourceType, new Permission(PolicyConstants.PERM_DELETE_ID, "policyframework")));
    }

    protected void updateInvalidResourceProperties(AbstractResourceForm<AccessRights> resourceForm) throws Exception {
        AccessRightsForm accessRightsForm = (AccessRightsForm) resourceForm;
        AccessRights resource = accessRightsForm.getResource();
        resource.addAccessRight(new AccessRight(resourceType, new Permission(PolicyConstants.PERM_EDIT_ID, "policyframework")));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void testEditCommitResourceInvalidPermission() throws Exception {
        AccessRights resource = executeEditRedirect();

        try {
            AccessRightsForm resourceForm = (AccessRightsForm) getActionForm();
            updateInvalidResourceProperties(resourceForm);

            StrutsExecutionStep executionStep = new StrutsExecutionStep(getRequestPath(), getInitialRequestPath());
            executionStep.addRequestParameter("actionTarget", "commit");
            executionStep.addMessage(getSavedMessage());
            executeStep(executionStep);
           
            AccessRights byId = getResourceById(resource.getResourceId());
            assertEquals(resourceForm.getResource(), byId);
            assertNotSame("Invalid permission added should not match", resource.getAccessRights(), byId.getAccessRights());
        } finally {
            deleteResource(resource);
        }
    }
View Full Code Here

    }

    public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        ActionForward actionForward = super.edit(mapping, form, request, response);
        AccessRightsForm arf = (AccessRightsForm) form;
        AccessRights accessRights = (AccessRights) ResourceStack.peekEditingStack(request.getSession());
        if (actionForward.getName().equals("home")){
            // super returned a home, so we must go home.
            return actionForward;
        }
        List<AccessRight> accessRights2 = accessRights.getAccessRights();
        PropertyList selectedAccessRights = new PropertyList();
        for (AccessRight right : accessRights2) {
            String permissionString = CoreUtil.getMessageResources(getSessionInfo(request).getHttpSession(),
                right.getPermission().getBundle()).getMessage("permission." + right.getPermission().getId() + ".title").trim();
            String resourceTypeString = CoreUtil.getMessageResources(getSessionInfo(request).getHttpSession(),
                right.getResourceType().getBundle()).getMessage(
                "resourceType." + right.getResourceType().getResourceTypeId() + ".title").trim();
            String lableString = resourceTypeString + " " + permissionString;
            selectedAccessRights.add(lableString);
        }
        AccessRightsMultiSelectDataSource accessRightsMultiSelectDataSource = new AccessRightsMultiSelectDataSource(accessRights
                        .getAccessRightsClass());
        MultiSelectSelectionModel accessRightsModel = new MultiSelectSelectionModel(getSessionInfo(request),
                        accessRightsMultiSelectDataSource, selectedAccessRights);
        arf.setAccessRightsModel(accessRightsModel);
        arf.setSelectedAccessRights(selectedAccessRights);
        return actionForward;
    }
View Full Code Here

     *      javax.servlet.http.HttpServletRequest,
     *      javax.servlet.http.HttpServletResponse)
     */
    public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        AccessRightsForm arf = (AccessRightsForm) form;
        AccessRights resource = (AccessRights) arf.getResource();
        PropertyList selectedAccessRightsList = arf.getSelectedAccessRightsList();
        resource.getAccessRights().clear();
        resource.setAllAccessRights(getSessionInfo(request).getHttpSession(), selectedAccessRightsList);
        saveMessage(request, "editAccessRights.message.saved", resource);
        super.commit(mapping, form, request, response);
        return getRedirectWithMessages(mapping, request);
View Full Code Here

TOP

Related Classes of com.adito.policyframework.forms.AccessRightsForm

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.