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

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


    public boolean canAccessRoot(Set<Principal> 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<Principal> principals) throws
                RepositoryException {
            this.cPermissions = new ArrayList<AbstractCompiledPermissions>();
            for (AccessControlProvider provider : providers) {
                CompiledPermissions cp = provider.compilePermissions(principals);
                if (cp instanceof AbstractCompiledPermissions) {
                    cPermissions.add((AbstractCompiledPermissions) cp);
                } else {
                    // TODO: deal with other implementations
                    log.warn("AbstractCompiledPermissions expected. Found " + cp.getClass().getName() + " -> ignore.");
                }
            }
        }
View Full Code Here

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

            }
        }));

        Path rootPath = ((SessionImpl) s).getQPath("/");
        for (Set<Principal> principals : principalSets) {
            CompiledPermissions cp = provider.compilePermissions(principals);

            assertFalse(cp.canReadAll());
            assertFalse(cp.grants(rootPath, Permission.READ));
            assertEquals(PrivilegeRegistry.NO_PRIVILEGE, cp.getPrivileges(rootPath));
            assertSame(CompiledPermissions.NO_PERMISSION, cp);
        }
    }
View Full Code Here

        Principal testPrincipal = getTestPrincipal();
        final User u = getUserManager(superuser).createUser(testPrincipal.getName(), "pw");
        save(superuser);

        Path rootPath = ((SessionImpl) s).getQPath("/");
        CompiledPermissions cp = null;
        try {
            Set<Principal> principals = Collections.singleton(u.getPrincipal());
            cp = provider.compilePermissions(principals);

            assertTrue(cp.canReadAll());
            assertTrue(cp.grants(rootPath, Permission.READ));
            assertNotSame(CompiledPermissions.NO_PERMISSION, cp);
        } finally {

            // remove the user to assert that the path doesn't point to an
            // existing node any more -> userNode cannot be resolved any more -> permissions denied.
            u.remove();
            save(superuser);

            if (cp != null) {
                assertFalse(cp.canReadAll());
                assertFalse(cp.grants(rootPath, Permission.READ));
                assertEquals(PrivilegeRegistry.NO_PRIVILEGE, cp.getPrivileges(rootPath));
            }
        }
    }
View Full Code Here

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

    public boolean canAccessRoot(Set<Principal> principals) throws RepositoryException {
        checkInitialized();
        if (isAdminOrSystem(principals)) {
            return true;
        } else {
            CompiledPermissions cp = new CompiledPermissionsImpl(principals, session, entryCollector, this, false);
            try {
                return cp.canRead(null, rootNodeId);
            } 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, false);
            return cp.grants(PathFactoryImpl.getInstance().getRootPath(), Permission.READ);
        }
    }
View Full Code Here

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

    public boolean canAccessRoot(Set principals) throws RepositoryException {
        checkInitialized();
        if (isAdminOrSystem(principals)) {
            return true;
        } else {
            CompiledPermissions cp = new AclPermissions(principals, false);
            return cp.grants(PathFactoryImpl.getInstance().getRootPath(), Permission.READ);
        }
    }
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.