Package com.adito.policyframework

Examples of com.adito.policyframework.Permission


     */
    public ActionForward doCommit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
        IpRestrictionForm ipRestrictionForm = (IpRestrictionForm)form;
        ipRestrictionForm.apply();
        Permission permission = ipRestrictionForm.isEditing() ? PolicyConstants.PERM_EDIT : PolicyConstants.PERM_CREATE;
        PolicyUtil.checkPermission(PolicyConstants.IP_RESTRICTIONS_RESOURCE_TYPE, permission, request);
       
        try {
            if(ipRestrictionForm.isEditing()) {       
                SystemDatabaseFactory.getInstance().updateIpRestriction(ipRestrictionForm.getRestriction());               
View Full Code Here


        setResourceService(new ResourceServiceAdapter<AccessRights>(resourceType));
    }

    @Override
    protected AccessRights getDefaultResource(int selectedRealmId) {
        AccessRight accessRight = new AccessRight(resourceType, new Permission(1, "policyFramework"));
        List<AccessRight> accessRightsList = Collections.singletonList(accessRight);
        return new DefaultAccessRights(selectedRealmId, -1, "MyNewAccessRight", "A test access right.", accessRightsList,
                        PolicyConstants.PERSONAL_CLASS, Calendar.getInstance(), Calendar.getInstance());
    }
View Full Code Here

   
    @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

    }

    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

        assertEquals("Permissions are correct", original.getAccessRights(), updated.getAccessRights());
    }

    @Override
    protected AccessRights getDefaultResource(int selectedRealmId) {
        AccessRight accessRight = new AccessRight(resourceType, new Permission(PolicyConstants.PERM_CREATE_AND_ASSIGN_ID, "policyframework"));
        List<AccessRight> accessRightsList = Collections.singletonList(accessRight);
        return new DefaultAccessRights(selectedRealmId, -1, "MyNewAccessRight", "A test access right.", accessRightsList,
                        PolicyConstants.PERSONAL_CLASS, Calendar.getInstance(), Calendar.getInstance());
    }
View Full Code Here

                        // Until the resource type matches
                        if (resource.getResourceType().equals(permission.getResourceType())) {
               
               
                            for (int x = 0; x < requiredPermissions.length; x++) {
                                Permission requiredPermission = requiredPermissions[x];
                                if ((permission.getPermission().getId() == requiredPermission.getId())
                                 && (requiredPermission.getId() == PolicyConstants.PERM_PERSONAL_CREATE_EDIT_AND_DELETE_ID)) {
                                    List policiesResource = getPoliciesAttachedToResource(resource, user.getRealm());
                                    if (policiesResource.size() != 1) {
                                        val = Boolean.FALSE;
                                    } else {
                                        Policy policy = (Policy) policiesResource.get(0);
View Full Code Here

                if (resourceType == null) {
                    log.warn("No resource type with Id of " + resourceTypeId + " for resource permission " + resourceId
                                    + ", ignoring");
                } else {
                    int permissionId = resultSet.getInt("permission_id");
                    Permission permission = resourceType.getPermission(permissionId);
                    if (permission == null) {
                        log.warn("No permission with Id of " + permissionId + " for resource type " + resourceTypeId
                                        + " and resource permission " + resourceId + ", ignoring");
                    } else {
                        AccessRight accessRight = new AccessRight(resourceType, permission);
View Full Code Here

                    List denied = new ArrayList();
                    while(t.hasMoreTokens()) {
                        String perm = t.nextToken();
                        if(perm.startsWith("!")) {
                            int id = Integer.parseInt(perm.substring(1));
                            Permission permInfo = resourceType.getPermission(id);
                            if(permInfo == null) {
                                throw new Error("No permission with ID of " + id + " in resource type " + resourceType.getResourceTypeId());
                            }
                            denied.add(permInfo);
                        }
                        else {
                            int id = Integer.parseInt(perm);
                            Permission permInfo = resourceType.getPermission(id);
                            if(permInfo == null) {
                                throw new Error("No permission with ID of " + id + " in resource type " + resourceType.getResourceTypeId());
                            }
                            allowed.add(permInfo);
                        }
View Full Code Here

TOP

Related Classes of com.adito.policyframework.Permission

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.