use of org.apache.archiva.redback.rbac.RbacManagerException 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.RbacManagerException 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);
}
}
use of org.apache.archiva.redback.rbac.RbacManagerException in project archiva by apache.
the class ArchivaRbacManager method saveRole.
@Override
public Role saveRole(Role role) throws RbacObjectInvalidException, RbacManagerException {
Exception lastException = null;
boolean allFailed = true;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
if (!rbacManager.isReadOnly()) {
role = rbacManager.saveRole(role);
allFailed = false;
}
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return role;
}
use of org.apache.archiva.redback.rbac.RbacManagerException in project archiva by apache.
the class ArchivaRbacManager method removeRole.
@Override
public void removeRole(Role role) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException {
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
rbacManager.removeRole(role);
rolesCache.remove(role.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.RbacManagerException in project archiva by apache.
the class ArchivaRbacManager method saveUserAssignment.
@Override
public UserAssignment saveUserAssignment(UserAssignment userAssignment) throws RbacObjectInvalidException, RbacManagerException {
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
if (!rbacManager.isReadOnly()) {
userAssignment = rbacManager.saveUserAssignment(userAssignment);
allFailed = false;
}
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return userAssignment;
}
Aggregations