use of org.apache.archiva.redback.rbac.Permission 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.Permission 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