use of org.apache.archiva.redback.rbac.RbacObjectNotFoundException in project archiva by apache.
the class ArchivaRbacManager method removePermission.
@Override
public void removePermission(Permission permission) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException {
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
rbacManager.removePermission(permission);
permissionsCache.remove(permission.getName());
allFailed = false;
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
}
use of org.apache.archiva.redback.rbac.RbacObjectNotFoundException in project archiva by apache.
the class ArchivaRbacManager method getRole.
@Override
public Role getRole(String roleName) throws RbacObjectNotFoundException, RbacManagerException {
Role el = rolesCache.get(roleName);
if (el != null) {
return el;
}
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
Role role = rbacManager.getRole(roleName);
if (role != null) {
rolesCache.put(role.getName(), role);
return role;
}
} catch (Exception e) {
lastException = e;
}
}
log.debug("cannot find role for name: ‘{}", roleName);
if (lastException != null) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return null;
}
use of org.apache.archiva.redback.rbac.RbacObjectNotFoundException in project archiva by apache.
the class ArchivaRbacManager method getResource.
@Override
public Resource getResource(String resourceIdentifier) throws RbacObjectNotFoundException, RbacManagerException {
Resource el = resourcesCache.get(resourceIdentifier);
if (el != null) {
return el;
}
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
Resource r = rbacManager.getResource(resourceIdentifier);
if (r != null) {
resourcesCache.put(resourceIdentifier, r);
return r;
}
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return null;
}
use of org.apache.archiva.redback.rbac.RbacObjectNotFoundException in project archiva by apache.
the class ArchivaRbacManager method removeResource.
@Override
public void removeResource(Resource resource) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException {
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
rbacManager.removeResource(resource);
resourcesCache.remove(resource.getIdentifier());
allFailed = false;
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
}
use of org.apache.archiva.redback.rbac.RbacObjectNotFoundException in project archiva by apache.
the class ArchivaRbacManager method getOperation.
@Override
public Operation getOperation(String operationName) throws RbacObjectNotFoundException, RbacManagerException {
Operation el = operationsCache.get(operationName);
if (el != null) {
return el;
}
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
Operation o = rbacManager.getOperation(operationName);
if (o != null) {
operationsCache.put(operationName, o);
return o;
}
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return null;
}
Aggregations