Search in sources :

Example 1 with NamedAccessControlPolicy

use of javax.jcr.security.NamedAccessControlPolicy in project jackrabbit-oak by apache.

the class CugAccessControlManagerTest method testRemoveInvalidPolicy.

@Test
public void testRemoveInvalidPolicy() throws Exception {
    List<AccessControlPolicy> invalidPolicies = ImmutableList.of(new AccessControlPolicy() {
    }, new NamedAccessControlPolicy() {

        public String getName() {
            return "name";
        }
    }, InvalidCug.INSTANCE);
    for (AccessControlPolicy policy : invalidPolicies) {
        try {
            cugAccessControlManager.removePolicy(SUPPORTED_PATH, policy);
            fail("Invalid cug policy must be detected.");
        } catch (AccessControlException e) {
        // success
        }
    }
}
Also used : JackrabbitAccessControlPolicy(org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy) NamedAccessControlPolicy(javax.jcr.security.NamedAccessControlPolicy) AccessControlPolicy(javax.jcr.security.AccessControlPolicy) AccessControlException(javax.jcr.security.AccessControlException) NamedAccessControlPolicy(javax.jcr.security.NamedAccessControlPolicy) Test(org.junit.Test)

Example 2 with NamedAccessControlPolicy

use of javax.jcr.security.NamedAccessControlPolicy in project jackrabbit-oak by apache.

the class CugAccessControlManagerTest method testSetInvalidPolicy.

@Test
public void testSetInvalidPolicy() throws Exception {
    List<AccessControlPolicy> invalidPolicies = ImmutableList.of(new AccessControlPolicy() {
    }, new NamedAccessControlPolicy() {

        public String getName() {
            return "name";
        }
    }, InvalidCug.INSTANCE);
    for (AccessControlPolicy policy : invalidPolicies) {
        try {
            cugAccessControlManager.setPolicy(SUPPORTED_PATH, policy);
            fail("Invalid cug policy must be detected.");
        } catch (AccessControlException e) {
        // success
        }
    }
}
Also used : JackrabbitAccessControlPolicy(org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy) NamedAccessControlPolicy(javax.jcr.security.NamedAccessControlPolicy) AccessControlPolicy(javax.jcr.security.AccessControlPolicy) AccessControlException(javax.jcr.security.AccessControlException) NamedAccessControlPolicy(javax.jcr.security.NamedAccessControlPolicy) Test(org.junit.Test)

Aggregations

AccessControlException (javax.jcr.security.AccessControlException)2 AccessControlPolicy (javax.jcr.security.AccessControlPolicy)2 NamedAccessControlPolicy (javax.jcr.security.NamedAccessControlPolicy)2 JackrabbitAccessControlPolicy (org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy)2 Test (org.junit.Test)2