Examples of PermissionProvider


Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    @Override
    public Privilege[] getPrivileges(@Nullable String absPath, @Nonnull Set<Principal> principals) throws RepositoryException {
        if (getPrincipals().equals(principals)) {
            return getPrivileges(absPath);
        } else {
            PermissionProvider provider = acConfig.getPermissionProvider(root, principals);
            return getPrivileges(absPath, provider, Permissions.READ_ACCESS_CONTROL);
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    //--------------------------------------------------< ValidatorProvider >---
    @Nonnull
    @Override
    public Validator getRootValidator(NodeState before, NodeState after) {
        ntMgr = ReadOnlyNodeTypeManager.getInstance(after);
        PermissionProvider pp = getPermissionProvider();
        return new PermissionValidator(createTree(before), createTree(after), pp, this);
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    //--------------------------------------------------< ValidatorProvider >---
    @Nonnull
    @Override
    public Validator getRootValidator(NodeState before, NodeState after) {
        PermissionProvider pp = acConfig.getPermissionProvider(new ImmutableRoot(before), workspaceName, principals);

        ImmutableTree rootBefore = new ImmutableTree(before);
        ImmutableTree rootAfter = new ImmutableTree(after);
        if (moveTracker.isEmpty()) {
            return new PermissionValidator(rootBefore, rootAfter, pp, this);
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    @Test
    public void testReadPath() throws Exception {
        ContentSession testSession = createTestSession();
        try {
            Root r = testSession.getLatestRoot();
            PermissionProvider pp = createPermissionProvider(testSession);

            Tree tree = r.getTree("/");
            assertFalse(tree.exists());
            assertFalse(pp.getTreePermission(tree, TreePermission.EMPTY).canRead());

            for (String path : READ_PATHS) {
                tree = r.getTree(path);
                assertTrue(tree.exists());
                assertTrue(pp.getTreePermission(tree, TreePermission.EMPTY).canRead());
            }
        } finally {
            testSession.close();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    @Test
    public void testIsGrantedForReadPaths() throws Exception {
        ContentSession testSession = createTestSession();
        try {
            PermissionProvider pp = createPermissionProvider(testSession) ;
            for (String path : READ_PATHS) {
                assertTrue(pp.isGranted(path, Permissions.getString(Permissions.READ)));
                assertTrue(pp.isGranted(path, Permissions.getString(Permissions.READ_NODE)));
                assertTrue(pp.isGranted(path + '/' + JcrConstants.JCR_PRIMARYTYPE, Permissions.getString(Permissions.READ_PROPERTY)));
                assertFalse(pp.isGranted(path, Permissions.getString(Permissions.READ_ACCESS_CONTROL)));
            }

            for (String path : READ_PATHS) {
                Tree tree = root.getTree(path);
                assertTrue(pp.isGranted(tree, null, Permissions.READ));
                assertTrue(pp.isGranted(tree, null, Permissions.READ_NODE));
                assertTrue(pp.isGranted(tree, tree.getProperty(JcrConstants.JCR_PRIMARYTYPE), Permissions.READ_PROPERTY));
                assertFalse(pp.isGranted(tree, null, Permissions.READ_ACCESS_CONTROL));
            }

            RepositoryPermission rp = pp.getRepositoryPermission();
            assertFalse(rp.isGranted(Permissions.READ));
            assertFalse(rp.isGranted(Permissions.READ_NODE));
            assertFalse(rp.isGranted(Permissions.READ_PROPERTY));
            assertFalse(rp.isGranted(Permissions.READ_ACCESS_CONTROL));
        } finally {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    @Test
    public void testGetPrivilegesForReadPaths() throws Exception {
        ContentSession testSession = createTestSession();
        try {
            PermissionProvider pp = createPermissionProvider(testSession) ;
            for (String path : READ_PATHS) {
                Tree tree = root.getTree(path);
                assertEquals(Collections.singleton(PrivilegeConstants.JCR_READ), pp.getPrivileges(tree));
            }
            assertEquals(Collections.<String>emptySet(), pp.getPrivileges(null));
        } finally {
            testSession.close();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    @Test
    public void testHasPrivilegesForReadPaths() throws Exception {
        ContentSession testSession = createTestSession();
        try {
            PermissionProvider pp = createPermissionProvider(testSession) ;
            for (String path : READ_PATHS) {
                Tree tree = root.getTree(path);
                assertTrue(pp.hasPrivileges(tree, PrivilegeConstants.JCR_READ));
                assertTrue(pp.hasPrivileges(tree, PrivilegeConstants.REP_READ_NODES));
                assertTrue(pp.hasPrivileges(tree, PrivilegeConstants.REP_READ_PROPERTIES));
                assertFalse(pp.hasPrivileges(tree, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
            }
            assertFalse(pp.hasPrivileges(null, PrivilegeConstants.JCR_READ));
        } finally {
            testSession.close();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

        ContentSession testSession = createTestSession();
        try {
            Root r = testSession.getLatestRoot();
            Root immutableRoot = new ImmutableRoot(r, TreeTypeProvider.EMPTY);

            PermissionProvider pp = createPermissionProvider(testSession) ;
            assertTrue(r.getTree("/").exists());
            TreePermission tp = pp.getTreePermission(immutableRoot.getTree("/"), TreePermission.EMPTY);
            assertSame(TreePermission.ALL, tp);

            for (String path : READ_PATHS) {
                Tree tree = r.getTree(path);
                assertTrue(tree.exists());
                assertSame(TreePermission.ALL, pp.getTreePermission(tree, TreePermission.EMPTY));
            }
        } finally {
            testSession.close();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    @Override
    public boolean hasPrivileges(@Nullable String absPath, @Nonnull Set<Principal> principals, @Nullable Privilege[] privileges) throws RepositoryException {
        if (getPrincipals().equals(principals)) {
            return hasPrivileges(absPath, privileges);
        } else {
            PermissionProvider provider = config.getPermissionProvider(root, workspaceName, principals);
            return hasPrivileges(absPath, privileges, provider, Permissions.READ_ACCESS_CONTROL, false);
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider

    @Override
    public Privilege[] getPrivileges(@Nullable String absPath, @Nonnull Set<Principal> principals) throws RepositoryException {
        if (getPrincipals().equals(principals)) {
            return getPrivileges(absPath);
        } else {
            PermissionProvider provider = config.getPermissionProvider(root, workspaceName, principals);
            return getPrivileges(absPath, provider, Permissions.READ_ACCESS_CONTROL);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.