Search in sources :

Example 6 with TreeType

use of org.apache.jackrabbit.oak.plugins.tree.TreeType in project jackrabbit-oak by apache.

the class CugPermissionProvider method canRead.

private boolean canRead(@Nonnull Tree tree) {
    Tree immutableTree = getImmutableTree(tree);
    TreeType type = typeProvider.getType(immutableTree);
    if (!isSupportedType(type) || !topPaths.hasAny()) {
        return false;
    }
    Tree cugRoot = getCugRoot(immutableTree, type);
    if (cugRoot != null) {
        Tree cugTree = CugUtil.getCug(cugRoot);
        if (cugTree != null) {
            return isAllow(cugTree);
        }
    }
    return false;
}
Also used : TreeType(org.apache.jackrabbit.oak.plugins.tree.TreeType) Tree(org.apache.jackrabbit.oak.api.Tree)

Example 7 with TreeType

use of org.apache.jackrabbit.oak.plugins.tree.TreeType in project jackrabbit-oak by apache.

the class CompiledPermissionImpl method buildParentPermission.

@Nonnull
private TreePermission buildParentPermission(@Nonnull Tree tree) {
    List<Tree> trees = new ArrayList<Tree>();
    while (!tree.isRoot()) {
        tree = tree.getParent();
        trees.add(0, tree);
    }
    TreePermission pp = EMPTY;
    TreeType type = TreeType.DEFAULT;
    for (Tree tr : trees) {
        type = typeProvider.getType(tr, type);
        pp = new TreePermissionImpl(tr, type, pp);
    }
    return pp;
}
Also used : TreeType(org.apache.jackrabbit.oak.plugins.tree.TreeType) ArrayList(java.util.ArrayList) Tree(org.apache.jackrabbit.oak.api.Tree) ImmutableTree(org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree) TreePermission(org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission) Nonnull(javax.annotation.Nonnull)

Aggregations

TreeType (org.apache.jackrabbit.oak.plugins.tree.TreeType)7 Tree (org.apache.jackrabbit.oak.api.Tree)6 Nonnull (javax.annotation.Nonnull)4 TreePermission (org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission)3 ImmutableTree (org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree)2 ArrayList (java.util.ArrayList)1 AggregatedPermissionProvider (org.apache.jackrabbit.oak.spi.security.authorization.permission.AggregatedPermissionProvider)1