Search in sources :

Example 11 with RepositoryPermission

use of org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission in project jackrabbit-oak by apache.

the class CompositeProviderScopeTest method testRepositoryPermissionIsGranted.

@Test
public void testRepositoryPermissionIsGranted() throws Exception {
    RepositoryPermission rp = cppTestUser.getRepositoryPermission();
    assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT | Permissions.NODE_TYPE_DEFINITION_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT | Permissions.PRIVILEGE_MANAGEMENT));
    assertTrue(rp.isGranted(Permissions.NODE_TYPE_DEFINITION_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.PRIVILEGE_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.NODE_TYPE_DEFINITION_MANAGEMENT | Permissions.PRIVILEGE_MANAGEMENT | Permissions.WORKSPACE_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.ALL));
}
Also used : RepositoryPermission(org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission) Test(org.junit.Test)

Example 12 with RepositoryPermission

use of org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission in project jackrabbit-oak by apache.

the class CompositeProviderScopeTest method testRepositoryPermissionIsGrantedAdmin.

@Test
public void testRepositoryPermissionIsGrantedAdmin() throws Exception {
    RepositoryPermission rp = cppAdminUser.getRepositoryPermission();
    assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT | Permissions.NODE_TYPE_DEFINITION_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.NAMESPACE_MANAGEMENT | Permissions.PRIVILEGE_MANAGEMENT));
    assertTrue(rp.isGranted(Permissions.NODE_TYPE_DEFINITION_MANAGEMENT));
    assertTrue(rp.isGranted(Permissions.PRIVILEGE_MANAGEMENT));
    assertTrue(rp.isGranted(Permissions.NODE_TYPE_DEFINITION_MANAGEMENT | Permissions.PRIVILEGE_MANAGEMENT | Permissions.WORKSPACE_MANAGEMENT));
    assertFalse(rp.isGranted(Permissions.ALL));
}
Also used : RepositoryPermission(org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission) Test(org.junit.Test)

Aggregations

RepositoryPermission (org.apache.jackrabbit.oak.spi.security.authorization.permission.RepositoryPermission)12 Test (org.junit.Test)12 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)3 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)1 Tree (org.apache.jackrabbit.oak.api.Tree)1 PermissionProvider (org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider)1