Package org.apache.jackrabbit.core.security.authorization

Examples of org.apache.jackrabbit.core.security.authorization.CompiledPermissions


    public boolean canAccessRoot(Set principals) throws RepositoryException {
        checkInitialized();
        if (isAdminOrSystem(principals)) {
            return true;
        } else {
            CompiledPermissions cp = new CompiledPermissionImpl(principals);
            try {
                Path rootPath = PathFactoryImpl.getInstance().getRootPath();
                return cp.grants(rootPath, Permission.READ);
            } finally {
                cp.close();
            }
        }
    }
View Full Code Here


         */
        private CompiledPermissionImpl(Set principals) throws
                RepositoryException {
            this.cPermissions = new ArrayList();
            for (int i = 0; i < providers.length; i++) {
                CompiledPermissions cp = providers[i].compilePermissions(principals);
                if (cp instanceof AbstractCompiledPermissions) {
                    cPermissions.add(cp);
                } else {
                    // TODO: deal with other impls.
                    log.warn("AbstractCompiledPermissions expected. Found " + cp.getClass().getName() + " -> ignore.");
                }
            }
        }
View Full Code Here

         * @see CompiledPermissions#close()
         */
        public synchronized void close() {
            // close all c-permissions retained in the list and clear the list.
            for (Iterator it = cPermissions.iterator(); it.hasNext();) {
                CompiledPermissions cp = (CompiledPermissions) it.next();
                cp.close();
                it.remove();
            }
            super.close();
        }
View Full Code Here

     */
    public Privilege[] getPrivileges(String absPath, Set<Principal> principals) throws PathNotFoundException, RepositoryException {
        checkInitialized();
        checkValidNodePath(absPath);
        checkPermission(absPath, Permission.READ_AC);
        CompiledPermissions perms = acProvider.compilePermissions(principals);
        try {
            int bits = perms.getPrivileges(resolver.getQPath(absPath));
            return (bits == PrivilegeRegistry.NO_PRIVILEGE) ?
                    new Privilege[0] :
                    privilegeRegistry.getPrivileges(bits);
        } finally {
            perms.close();
        }
    }
View Full Code Here

    public boolean canAccessRoot(Set<Principal> principals) throws RepositoryException {
        checkInitialized();
        if (isAdminOrSystem(principals)) {
            return true;
        } else {
            CompiledPermissions cp = new AclPermissions(principals, false);
            return cp.canRead(null, rootNodeId);
        }
    }
View Full Code Here

            // null or empty privilege array -> return true
            log.debug("No privileges passed -> allowed.");
            return true;
        } else {
            Path p = getPath(absPath);
            CompiledPermissions perms = acProvider.compilePermissions(principals);
            try {
                return perms.hasPrivileges(p, privileges);
            } finally {
                perms.close();
            }
        }
    }
View Full Code Here

    public Privilege[] getPrivileges(String absPath, Set<Principal> principals) throws PathNotFoundException, RepositoryException {
        checkInitialized();
        checkValidNodePath(absPath);
        checkPermission(absPath, Permission.READ_AC);

        CompiledPermissions perms = acProvider.compilePermissions(principals);
        try {
            Set<Privilege> privs = perms.getPrivilegeSet(getPath(absPath));
            return privs.toArray(new Privilege[privs.size()]);
        } finally {
            perms.close();
        }
    }
View Full Code Here

    checkInitialized();
    if ( isAdminOrSystem( principals ) ) {

      return true;
    } else {
      CompiledPermissions cp = getCompiledPermissions( principals );
      try {
        return cp.canRead( null, getRootNodeId() );
      } finally {
        cp.close();
      }
    }
  }
View Full Code Here

    public boolean canAccessRoot(Set principals) throws RepositoryException {
        checkInitialized();
        if (isAdminOrSystem(principals)) {
            return true;
        } else {
            CompiledPermissions cp = new CompiledPermissionImpl(principals);
            try {
                Path rootPath = PathFactoryImpl.getInstance().getRootPath();
                return cp.grants(rootPath, Permission.READ);
            } finally {
                cp.close();
            }
        }
    }
View Full Code Here

         */
        private CompiledPermissionImpl(Set principals) throws
                RepositoryException {
            this.cPermissions = new ArrayList();
            for (int i = 0; i < providers.length; i++) {
                CompiledPermissions cp = providers[i].compilePermissions(principals);
                if (cp instanceof AbstractCompiledPermissions) {
                    cPermissions.add(cp);
                } else {
                    // TODO: deal with other impls.
                    log.warn("AbstractCompiledPermissions expected. Found " + cp.getClass().getName() + " -> ignore.");
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.security.authorization.CompiledPermissions

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.