use of javax.jcr.security.AccessControlException in project jackrabbit by apache.
the class PrivilegeManagerImpl method getPrivilege.
// ------------------------------------------------------------< private >---
/**
* @param name
* @return The privilege with the specified name.
* @throws AccessControlException
* @throws RepositoryException
*/
private Privilege getPrivilege(Name name) throws AccessControlException, RepositoryException {
Privilege privilege;
synchronized (cache) {
if (cache.containsKey(name)) {
privilege = cache.get(name);
} else {
PrivilegeDefinition def = registry.get(name);
if (def != null) {
privilege = new PrivilegeImpl(def);
cache.put(name, privilege);
} else {
throw new AccessControlException("Unknown privilege " + resolver.getJCRName(name));
}
}
}
return privilege;
}
use of javax.jcr.security.AccessControlException in project jackrabbit by apache.
the class PrivilegeManagerImplTest method testGetBitsFromCustomPrivilege.
public void testGetBitsFromCustomPrivilege() throws AccessControlException {
Privilege p = buildCustomPrivilege(Privilege.JCR_READ, null);
try {
getPrivilegeManagerImpl().getBits(p);
fail("Retrieving bits from unknown privilege should fail.");
} catch (AccessControlException e) {
// ok
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit by apache.
the class PrivilegeManagerImplTest method testGetBitsWithInvalidPrivilege.
public void testGetBitsWithInvalidPrivilege() {
Privilege p = buildCustomPrivilege("anyName", null);
try {
getPrivilegeManagerImpl().getBits(p);
fail();
} catch (AccessControlException e) {
// ok
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit by apache.
the class PrivilegeRegistryTest method testGetBitsWithInvalidPrivilege.
public void testGetBitsWithInvalidPrivilege() {
Privilege p = buildUnregisteredPrivilege("anyName", null);
try {
PrivilegeRegistry.getBits(new Privilege[] { p });
fail();
} catch (AccessControlException e) {
// ok
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit by apache.
the class PrivilegeRegistryTest method testGetBitsFromInvalidPrivilege.
public void testGetBitsFromInvalidPrivilege() throws AccessControlException {
Privilege p = buildUnregisteredPrivilege(Privilege.JCR_READ, null);
try {
PrivilegeRegistry.getBits(new Privilege[] { p });
fail("Retrieving bits from unknown privilege should fail.");
} catch (AccessControlException e) {
// ok
}
}
Aggregations