use of org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission in project jackrabbit-oak by apache.
the class CompositeProviderEmptyTest method testRepositoryPermissionsIsGranted.
@Test
public void testRepositoryPermissionsIsGranted() throws Exception {
RepositoryPermission rp = cpp.getRepositoryPermission();
assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT));
assertFalse(rp.isGranted(Permissions.NODE_TYPE_DEFINITION_MANAGEMENT));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission in project jackrabbit-oak by apache.
the class CompositeProviderAllTest method testRepositoryPermissionsIsGranted.
@Test
public void testRepositoryPermissionsIsGranted() throws Exception {
RepositoryPermission rp = cpp.getRepositoryPermission();
assertTrue(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT));
assertTrue(rp.isGranted(Permissions.NODE_TYPE_DEFINITION_MANAGEMENT));
assertTrue(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT | Permissions.NODE_TYPE_DEFINITION_MANAGEMENT));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission in project jackrabbit-oak by apache.
the class AbstractCompositeProviderTest method testRepositoryPermissionIsNotGranted.
@Test
public void testRepositoryPermissionIsNotGranted() throws Exception {
RepositoryPermission rp = createPermissionProvider().getRepositoryPermission();
assertFalse(rp.isGranted(Permissions.PRIVILEGE_MANAGEMENT));
assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT | Permissions.PRIVILEGE_MANAGEMENT));
assertFalse(rp.isGranted(Permissions.WORKSPACE_MANAGEMENT));
assertFalse(rp.isGranted(Permissions.ALL));
assertFalse(rp.isGranted(Permissions.NO_PERMISSION));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission in project jackrabbit-oak by apache.
the class AbstractCompositeProviderTest method testGetRepositoryPermissionInstance.
@Test
public void testGetRepositoryPermissionInstance() throws Exception {
RepositoryPermission rp = createPermissionProvider().getRepositoryPermission();
assertTrue(rp.getClass().getName().endsWith("CompositeRepositoryPermission"));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission in project jackrabbit-oak by apache.
the class PermissionProviderImplTest method testIsGrantedForReadPaths.
@Test
public void testIsGrantedForReadPaths() throws Exception {
ContentSession testSession = createTestSession();
try {
PermissionProvider pp = createPermissionProvider(testSession);
for (String path : READ_PATHS) {
assertTrue(pp.isGranted(path, Permissions.getString(Permissions.READ)));
assertTrue(pp.isGranted(path, Permissions.getString(Permissions.READ_NODE)));
assertTrue(pp.isGranted(path + '/' + JcrConstants.JCR_PRIMARYTYPE, Permissions.getString(Permissions.READ_PROPERTY)));
assertFalse(pp.isGranted(path, Permissions.getString(Permissions.READ_ACCESS_CONTROL)));
}
for (String path : READ_PATHS) {
Tree tree = root.getTree(path);
assertTrue(pp.isGranted(tree, null, Permissions.READ));
assertTrue(pp.isGranted(tree, null, Permissions.READ_NODE));
assertTrue(pp.isGranted(tree, tree.getProperty(JcrConstants.JCR_PRIMARYTYPE), Permissions.READ_PROPERTY));
assertFalse(pp.isGranted(tree, null, Permissions.READ_ACCESS_CONTROL));
}
RepositoryPermission rp = pp.getRepositoryPermission();
assertFalse(rp.isGranted(Permissions.READ));
assertFalse(rp.isGranted(Permissions.READ_NODE));
assertFalse(rp.isGranted(Permissions.READ_PROPERTY));
assertFalse(rp.isGranted(Permissions.READ_ACCESS_CONTROL));
} finally {
testSession.close();
}
}
Aggregations