use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class PermissionProviderImplTest method testReadPath.
@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();
}
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class PermissionStoreTest method testHasPrivilege.
@Test
public void testHasPrivilege() {
PermissionProvider pp = createPermissionProvider();
Tree t = root.getTree(PermissionConstants.PERMISSIONS_STORE_PATH);
assertFalse(pp.hasPrivileges(t, PrivilegeConstants.JCR_READ));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class PermissionStoreTest method testGetTreePermission.
@Test
public void testGetTreePermission() {
PermissionProvider pp = createPermissionProvider();
Tree t = root.getTree(PermissionConstants.PERMISSIONS_STORE_PATH);
assertSame(TreePermission.EMPTY, pp.getTreePermission(t, TreePermission.EMPTY));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class PermissionProviderImplTest method testAdministatorConfig.
@Test
public void testAdministatorConfig() throws Exception {
adminstrators.addMember(getTestUser());
root.commit();
ContentSession testSession = createTestSession();
try {
Root r = testSession.getLatestRoot();
Root immutableRoot = RootFactory.createReadOnlyRoot(r);
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();
}
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class PermissionProviderImplTest method testGetPrivilegesForReadPaths.
@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();
}
}
Aggregations