use of org.apache.archiva.redback.rbac.RbacManagerException in project archiva by apache.
the class ArchivaRbacManager method removeUserAssignment.
@Override
public void removeUserAssignment(UserAssignment userAssignment) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException {
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
rbacManager.removeUserAssignment(userAssignment);
userAssignmentsCache.remove(userAssignment.getPrincipal());
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 saveRoles.
@Override
public void saveRoles(Collection<Role> roles) throws RbacObjectInvalidException, RbacManagerException {
Exception lastException = null;
boolean allFailed = true;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
if (!rbacManager.isReadOnly()) {
rbacManager.saveRoles(roles);
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 saveOperation.
@Override
public Operation saveOperation(Operation operation) throws RbacObjectInvalidException, RbacManagerException {
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
if (!rbacManager.isReadOnly()) {
operation = rbacManager.saveOperation(operation);
allFailed = false;
}
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return operation;
}
use of org.apache.archiva.redback.rbac.RbacManagerException in project archiva by apache.
the class ArchivaRbacManager method getAllPermissions.
@Override
public List<Permission> getAllPermissions() throws RbacManagerException {
Map<String, Permission> allPermissions = new HashMap<>();
boolean allFailed = true;
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
List<Permission> permissions = rbacManager.getAllPermissions();
for (Permission p : permissions) {
allPermissions.put(p.getName(), p);
}
allFailed = false;
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null && allFailed) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return new ArrayList<>(allPermissions.values());
}
use of org.apache.archiva.redback.rbac.RbacManagerException in project archiva by apache.
the class ArchivaRbacManager method getPermission.
@Override
public Permission getPermission(String permissionName) throws RbacObjectNotFoundException, RbacManagerException {
Permission el = permissionsCache.get(permissionName);
if (el != null) {
return el;
}
Exception lastException = null;
for (RBACManager rbacManager : rbacManagersPerId.values()) {
try {
Permission p = rbacManager.getPermission(permissionName);
if (p != null) {
permissionsCache.put(permissionName, p);
return p;
}
} catch (Exception e) {
lastException = e;
}
}
if (lastException != null) {
throw new RbacManagerException(lastException.getMessage(), lastException);
}
return null;
}
Aggregations