Package com.adito.policyframework

Examples of com.adito.policyframework.AccessRight


          user)) {
        val = Boolean.TRUE;
      } else {
        List resourcePermissions = getAccessRights();
        AccessRights resourcePermission = null;
        AccessRight permission = null;
        // Iterator through all resource permissions
        Map<String,Boolean> matched = new HashMap<String,Boolean>();
        for (Iterator i = resourcePermissions.iterator(); val == null
            && i.hasNext();) {
          resourcePermission = (AccessRights) i.next();
          // Iterator through all permissions in the resource
          for (Iterator j = resourcePermission.getAccessRights()
              .iterator(); val == null && j.hasNext();) {
            permission = (AccessRight) j.next();
            // Until the resource type matches
            if (resourceType.equals(permission.getResourceType())) {
              // Check the mask, at least one must match
              for (int x = 0; requiredPermissions!=null && x < requiredPermissions.length; x++) {
                if (permission.getPermission().getId() == requiredPermissions[x]
                    .getId()) {
                  // Check if the user in a policy
                  if (isPrincipalAllowed(user,
                      resourcePermission, true)) {
                    String key = String
View Full Code Here


                val = Boolean.TRUE;
            } else {
                val = Boolean.FALSE;
                List resourcePermissions = getAccessRights();
                AccessRights resourcePermission = null;
                AccessRight permission = null;
                // Iterator through all resource permissions
               
                for (Iterator i = resourcePermissions.iterator();  !val && i.hasNext();) {
                    resourcePermission = (AccessRights) i.next();
                    // Iterator through all permissions in the resource
                    for (Iterator j = resourcePermission.getAccessRights().iterator();  !val && j.hasNext();) {
                        permission = (AccessRight) j.next();
                        // 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 {
View Full Code Here

    List<Policy> l = (List<Policy>) policyCache.retrieve(cacheKey);
    if (l == null) {
      l = new ArrayList<Policy>();
      List resourcePermissions = getAccessRights();
      AccessRights resourcePermission = null;
      AccessRight accessRight = null;
      for (Iterator i = resourcePermissions.iterator(); i.hasNext();) {
        resourcePermission = (AccessRights) i.next();
        if (isPrincipalAllowed(user, resourcePermission, true)) {
          if (permissionClass == null
              || permissionClass.equals(resourcePermission
                  .getAccessRightsClass())) {
            for (Iterator j = resourcePermission.getAccessRights()
                .iterator(); j.hasNext();) {

              accessRight = (AccessRight) j
                  .next();
              if (resourceType == null
                  || resourceType
                      .equals(accessRight
                          .getResourceType())) {
                // LDP - Add the policies attached to a resource
                // as well
                List del = getPoliciesAttachedToResource(resourcePermission, user.getRealm());
View Full Code Here

    List<AccessRights> l = (List<AccessRights>) policyCache.retrieve(cacheKey);
    if (l == null) {
      l = new ArrayList<AccessRights>();
      List resourcePermissions = getAccessRights();
      AccessRights resourcePermission = null;
      AccessRight accessRight = null;

      /*
             * First iterate through all of the resource permissions looking for
             * what is visible at the top level.
             */

      for (Iterator i = resourcePermissions.iterator(); i.hasNext();) {
        resourcePermission = (AccessRights) i.next();
        if (permissionClass == null
            || permissionClass.equals(resourcePermission
                .getAccessRightsClass())) {
          // Check the user is allowed
        if (isPrincipalAllowed(
                user, resourcePermission, true)) {
            // Iterator through all permissions in the resource
            for (Iterator j = resourcePermission
                .getAccessRights().iterator(); j.hasNext();) {
              accessRight = (AccessRight) j
                  .next();
              // Until the resource type matches
              if (resourceType == null
                  || resourceType
                      .equals(accessRight
                          .getResourceType())) {
                // Until at least one permission matches
                if (permission == null
                    || permission.getId() == accessRight
                        .getPermission()
                        .getId()) {
                  l.add(resourcePermission);
                  break;
                }
View Full Code Here

      ArrayList<AccessRights> l = new ArrayList<AccessRights>();
      boolean superUser = LogonControllerFactory.getInstance()
          .isAdministrator(user);
      List allAccessRights = getAccessRights();
      AccessRights accessRights = null;
      AccessRight accessRight = null;

      /*
       * First iterate through all of the resource permissions looking for
       * what is visible at the top level.
       */

      for (Iterator i = allAccessRights.iterator(); i.hasNext();) {
                accessRights = (AccessRights) i.next();
                if (permissionClass == null || permissionClass.equals(accessRights.getAccessRightsClass())) {
                    // Check the user is allowed
                    if (isPrincipalAllowed(user, accessRights, true)) {

                        // Iterator through all permissions in the resource
                        for (Iterator j = accessRights.getAccessRights().iterator(); j.hasNext();) {
                            accessRight = (AccessRight) j.next();
                            // Until the resource type matches
                            if (resourceType == null || resourceType.equals(accessRight.getResourceType())) {
                                // Until at least one permission matches
                                if (permission == null || permission.getId() == accessRight.getPermission().getId()) {
                                    l.add(accessRights);
                                    break;
                                }
                            }
                        }
View Full Code Here

                    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);
                        permissions.add(accessRight);
                    }
                }
            } else {
                log.debug("Access Rights with name " + accessRights.getResourceName() + " has no permissions.");
View Full Code Here

  void updateResourcePermissionRelationships(JDBCPreparedStatement ps,
      AccessRights dr) throws Exception {
    deleteResourcePermissionRelationships(ps, dr.getResourceId());
    for (Iterator i = dr.getAccessRights().iterator(); i.hasNext();) {
      AccessRight perm = (AccessRight) i
          .next();
      JDBCPreparedStatement ps2 = db
          .getStatement("updateResourcePermission.insertPermissions");
      try {
        ps2.setInt(1, dr.getResourceId());
        ps2.setInt(2, perm.getResourceType().getResourceTypeId());
        ps2.setInt(3, perm.getPermission().getId());
        ps2.execute();
      } finally {
        ps2.releasePreparedStatement();
      }
    }
View Full Code Here

                    try {
                        available = PolicyDatabaseFactory.getInstance().isAnyAccessRightAllowed(info.getUser(), true, true, false) && CoreUtil.isMenuAvailable(request);
                        if (available) {
                            List<AccessRight> listAccessRight = PolicyDatabaseFactory.getInstance().getAnyAccessRightAllowed(info.getUser(), true ,true, false);
                            for (Iterator iter = listAccessRight.iterator(); iter.hasNext();) {
                                    AccessRight accessRight = (AccessRight) iter.next();
                                    if (!PolicyConstants.PERM_PERSONAL_CREATE_EDIT_AND_DELETE.equals(accessRight.getPermission())) {
                                        return true;
                                    }
                            }
                            return false;
                        }
View Full Code Here

TOP

Related Classes of com.adito.policyframework.AccessRight

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.