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();
}
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();
}
}
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()])));
}
}
}
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);
}
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);
}
Aggregations