Search in sources :

Example 11 with PrivilegeBitsProvider

use of org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider in project jackrabbit-oak by apache.

the class CompiledPermissionImpl method refresh.

//------------------------------------------------< CompiledPermissions >---
@Override
public void refresh(@Nonnull Root root, @Nonnull String workspaceName) {
    this.root = root;
    this.bitsProvider = new PrivilegeBitsProvider(root);
    this.versionManager = null;
    store.flush(root);
    userStore.flush();
    groupStore.flush();
}
Also used : PrivilegeBitsProvider(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider)

Example 12 with PrivilegeBitsProvider

use of org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider in project jackrabbit-oak by apache.

the class CompositePermissionProvider method refresh.

//-------------------------------------------------< PermissionProvider >---
@Override
public void refresh() {
    immutableRoot = RootFactory.createReadOnlyRoot(root);
    privilegeBitsProvider = new PrivilegeBitsProvider(immutableRoot);
    for (PermissionProvider pp : pps) {
        pp.refresh();
    }
}
Also used : PrivilegeBitsProvider(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider) PermissionProvider(org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider) AggregatedPermissionProvider(org.apache.jackrabbit.oak.spi.security.authorization.permission.AggregatedPermissionProvider)

Example 13 with PrivilegeBitsProvider

use of org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider in project jackrabbit-oak by apache.

the class CompositeProviderFullScopeTest method testHasPrivileges.

@Test
public void testHasPrivileges() throws Exception {
    PrivilegeBitsProvider pbp = new PrivilegeBitsProvider(readOnlyRoot);
    PrivilegeBits readNodes = pbp.getBits(REP_READ_NODES);
    for (String path : defPrivileges.keySet()) {
        Set<String> defaultPrivs = defPrivileges.get(path);
        PrivilegeBits defaultBits = pbp.getBits(defaultPrivs);
        Tree tree = readOnlyRoot.getTree(path);
        if (defaultPrivs.isEmpty()) {
            assertFalse(path, cppTestUser.hasPrivileges(tree, REP_READ_NODES));
        } else if (defaultBits.includes(readNodes)) {
            assertTrue(path, cppTestUser.hasPrivileges(tree, REP_READ_NODES));
            if (!readNodes.equals(defaultBits)) {
                assertFalse(path, cppTestUser.hasPrivileges(tree, defaultPrivs.toArray(new String[defaultPrivs.size()])));
            }
        } else {
            assertFalse(path, cppTestUser.hasPrivileges(tree, REP_READ_NODES));
            assertFalse(path, cppTestUser.hasPrivileges(tree, defaultPrivs.toArray(new String[defaultPrivs.size()])));
        }
    }
}
Also used : PrivilegeBitsProvider(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider) Tree(org.apache.jackrabbit.oak.api.Tree) PrivilegeBits(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBits) Test(org.junit.Test)

Example 14 with PrivilegeBitsProvider

use of org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider in project jackrabbit-oak by apache.

the class CompositeProviderScopeTest method before.

@Override
public void before() throws Exception {
    super.before();
    cppTestUser = createPermissionProvider(getTestUser().getPrincipal(), EveryonePrincipal.getInstance());
    cppAdminUser = createPermissionProvider(root.getContentSession().getAuthInfo().getPrincipals());
    pbp = new PrivilegeBitsProvider(readOnlyRoot);
    denied = pbp.getBits(JCR_ADD_CHILD_NODES, REP_ADD_PROPERTIES);
}
Also used : PrivilegeBitsProvider(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider)

Example 15 with PrivilegeBitsProvider

use of org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider in project jackrabbit-oak by apache.

the class JcrAllTest method before.

@Override
public void before() throws Exception {
    super.before();
    bitsProvider = new PrivilegeBitsProvider(root);
}
Also used : PrivilegeBitsProvider(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider)

Aggregations

PrivilegeBitsProvider (org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider)16 PrivilegeBits (org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBits)6 Test (org.junit.Test)6 Tree (org.apache.jackrabbit.oak.api.Tree)5 Before (org.junit.Before)3 Nonnull (javax.annotation.Nonnull)2 AccessControlManager (javax.jcr.security.AccessControlManager)1 JackrabbitAccessControlList (org.apache.jackrabbit.api.security.JackrabbitAccessControlList)1 PrivilegeManager (org.apache.jackrabbit.api.security.authorization.PrivilegeManager)1 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)1 Root (org.apache.jackrabbit.oak.api.Root)1 L4_PrivilegesAndPermissionsTest (org.apache.jackrabbit.oak.exercise.security.authorization.permission.L4_PrivilegesAndPermissionsTest)1 L7_PermissionContentTest (org.apache.jackrabbit.oak.exercise.security.authorization.permission.L7_PermissionContentTest)1 TypePredicate (org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate)1 AuthorizationConfiguration (org.apache.jackrabbit.oak.spi.security.authorization.AuthorizationConfiguration)1 AggregatedPermissionProvider (org.apache.jackrabbit.oak.spi.security.authorization.permission.AggregatedPermissionProvider)1 PermissionProvider (org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider)1 RestrictionProvider (org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider)1 PrivilegeConfiguration (org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration)1 DefaultNodeStateDiff (org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff)1