use of org.apache.archiva.redback.rbac.RBACManager 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.RBACManager 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;
}
use of org.apache.archiva.redback.rbac.RBACManager in project archiva by apache.
the class ArchivaRbacManager method getUserAssignment.
@Override
public UserAssignment getUserAssignment(String principal) throws RbacObjectNotFoundException, RbacManagerException {
UserAssignment el = userAssignmentsCache.get(principal);
if (el != null) {
return el;
}
UserAssignment ua = null;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
if (ua == null) {
ua = rbacManager.getUserAssignment(principal);
} else {
UserAssignment userAssignment = rbacManager.getUserAssignment(principal);
if (userAssignment != null) {
for (String roleName : userAssignment.getRoleNames()) {
ua.addRoleName(roleName);
}
}
}
} catch (Exception e) {
lastException = e;
}
}
if (ua != null) {
userAssignmentsCache.put(principal, ua);
return ua;
}
if (lastException != null) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return null;
}
use of org.apache.archiva.redback.rbac.RBACManager in project archiva by apache.
the class ArchivaRbacManager method getAllOperations.
@Override
public List<Operation> getAllOperations() throws RbacManagerException {
Map<String, Operation> allOperations = new HashMap<>();
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
List<Operation> operations = rbacManager.getAllOperations();
for (Operation o : operations) {
allOperations.put(o.getName(), o);
}
allFailed = false;
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return new ArrayList<>(allOperations.values());
}
use of org.apache.archiva.redback.rbac.RBACManager in project archiva by apache.
the class ArchivaRbacManager method removeOperation.
@Override
public void removeOperation(Operation operation) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException {
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
rbacManager.removeOperation(operation);
operationsCache.remove(operation.getName());
allFailed = false;
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
}
Aggregations