Package org.apache.jackrabbit.oak.core

Examples of org.apache.jackrabbit.oak.core.ImmutableRoot


    @Override
    public NodeState processCommit(final NodeState before, NodeState after) throws CommitFailedException {
        NodeBuilder rootAfter = after.builder();

        permissionRoot = getPermissionRoot(rootAfter);
        bitsProvider = new PrivilegeBitsProvider(new ImmutableRoot(before));

        isACL = new TypePredicate(after, NT_REP_ACL);
        isACE = new TypePredicate(after, NT_REP_ACE);
        isGrantACE = new TypePredicate(after, NT_REP_GRANT_ACE);
View Full Code Here


    }

    @Nonnull
    @Override
    protected Root getWorkspaceRoot() {
        return new ImmutableRoot(workspaceRoot.getNodeState());
    }
View Full Code Here

    private static ImmutableRoot getImmutableRoot(Root base, SecurityConfiguration acConfig) {
        if (base instanceof ImmutableRoot) {
            return (ImmutableRoot) base;
        } else {
            return new ImmutableRoot(base, new TreeTypeProviderImpl(acConfig.getContext()));
        }
    }
View Full Code Here

        Tree rootBefore = new ImmutableTree(before);
        Tree rootAfter = new ImmutableTree(after);

        RestrictionProvider restrictionProvider = getConfig(AuthorizationConfiguration.class).getRestrictionProvider();

        Root root = new ImmutableRoot(before);
        Map<String, Privilege> privileges = getPrivileges(root);
        PrivilegeBitsProvider privilegeBitsProvider = new PrivilegeBitsProvider(root);
        ReadOnlyNodeTypeManager ntMgr = ReadOnlyNodeTypeManager.getInstance(before);

        return new AccessControlValidator(rootBefore, rootAfter, privileges, privilegeBitsProvider, restrictionProvider, ntMgr);
View Full Code Here

        assertFalse(cp.hasPrivileges(null, PrivilegeConstants.JCR_READ));
    }

    private CompiledPermissionImpl createPermissions(Set<Principal> principals) {
        ImmutableTree permissionsTree = new ImmutableRoot(root, TreeTypeProvider.EMPTY).getTree(PERMISSIONS_STORE_PATH);
        return new CompiledPermissionImpl(principals, permissionsTree, pbp, rp, ImmutableSet.copyOf(DEFAULT_READ_PATHS));
    }
View Full Code Here

            }
        }
    }

    private static ImmutableTree getTree(NodeState beforeState, String path) {
        return new ImmutableRoot(beforeState).getTree(path);
    }
View Full Code Here

    public NodeState processCommit(final NodeState before, NodeState after) throws CommitFailedException {
        NodeBuilder rootAfter = after.builder();

        permissionRoot = getPermissionRoot(rootAfter);
        ntMgr = ReadOnlyNodeTypeManager.getInstance(before);
        bitsProvider = new PrivilegeBitsProvider(new ImmutableRoot(before));

        after.compareAgainstBaseState(before, new Diff(new BeforeNode(before), new AfterNode(rootAfter)));
        return rootAfter.getNodeState();
    }
View Full Code Here

    @Test
    public void testReadPath() throws Exception {
        ContentSession testSession = createTestSession();
        try {
            Root r = testSession.getLatestRoot();
            Root immutableRoot = new ImmutableRoot(r, TreeTypeProvider.EMPTY);

            PermissionProvider pp = new PermissionProviderImpl(testSession.getLatestRoot(), testSession.getAuthInfo().getPrincipals(), getSecurityProvider());

            assertFalse(r.getTree("/").exists());
            assertSame(ReadStatus.DENY_THIS, pp.getReadStatus(immutableRoot.getTree("/"), null));

            for (String path : READ_PATHS) {
                assertTrue(r.getTree(path).exists());
                assertSame(ReadStatus.ALLOW_ALL_REGULAR, pp.getReadStatus(immutableRoot.getTree(path), null));
            }
        } finally {
            testSession.close();
        }
    }
View Full Code Here

        root.commit();

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

            PermissionProvider pp = new PermissionProviderImpl(testSession.getLatestRoot(), testSession.getAuthInfo().getPrincipals(), getSecurityProvider());

            assertTrue(r.getTree("/").exists());
            assertSame(ReadStatus.ALLOW_ALL, pp.getReadStatus(immutableRoot.getTree("/"), null));

            for (String path : READ_PATHS) {
                assertTrue(r.getTree(path).exists());
                assertSame(ReadStatus.ALLOW_ALL, pp.getReadStatus(immutableRoot.getTree(path), null));
            }
        } finally {
            testSession.close();
        }
    }
View Full Code Here

        root.commit();

        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());
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.core.ImmutableRoot

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.