Search in sources :

Example 6 with RbacObjectInvalidException

use of org.apache.archiva.redback.rbac.RbacObjectInvalidException 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;
}
Also used : RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) AbstractRBACManager(org.apache.archiva.redback.rbac.AbstractRBACManager) RBACManager(org.apache.archiva.redback.rbac.RBACManager) RbacObjectNotFoundException(org.apache.archiva.redback.rbac.RbacObjectNotFoundException) RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) RbacObjectInvalidException(org.apache.archiva.redback.rbac.RbacObjectInvalidException)

Example 7 with RbacObjectInvalidException

use of org.apache.archiva.redback.rbac.RbacObjectInvalidException 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);
    }
}
Also used : RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) AbstractRBACManager(org.apache.archiva.redback.rbac.AbstractRBACManager) RBACManager(org.apache.archiva.redback.rbac.RBACManager) RbacObjectNotFoundException(org.apache.archiva.redback.rbac.RbacObjectNotFoundException) RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) RbacObjectInvalidException(org.apache.archiva.redback.rbac.RbacObjectInvalidException)

Example 8 with RbacObjectInvalidException

use of org.apache.archiva.redback.rbac.RbacObjectInvalidException 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;
}
Also used : RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) AbstractRBACManager(org.apache.archiva.redback.rbac.AbstractRBACManager) RBACManager(org.apache.archiva.redback.rbac.RBACManager) RbacObjectNotFoundException(org.apache.archiva.redback.rbac.RbacObjectNotFoundException) RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) RbacObjectInvalidException(org.apache.archiva.redback.rbac.RbacObjectInvalidException)

Example 9 with RbacObjectInvalidException

use of org.apache.archiva.redback.rbac.RbacObjectInvalidException 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);
    }
}
Also used : RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) AbstractRBACManager(org.apache.archiva.redback.rbac.AbstractRBACManager) RBACManager(org.apache.archiva.redback.rbac.RBACManager) RbacObjectNotFoundException(org.apache.archiva.redback.rbac.RbacObjectNotFoundException) RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) RbacObjectInvalidException(org.apache.archiva.redback.rbac.RbacObjectInvalidException)

Example 10 with RbacObjectInvalidException

use of org.apache.archiva.redback.rbac.RbacObjectInvalidException 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);
    }
}
Also used : RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) AbstractRBACManager(org.apache.archiva.redback.rbac.AbstractRBACManager) RBACManager(org.apache.archiva.redback.rbac.RBACManager) RbacObjectNotFoundException(org.apache.archiva.redback.rbac.RbacObjectNotFoundException) RbacManagerException(org.apache.archiva.redback.rbac.RbacManagerException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) RbacObjectInvalidException(org.apache.archiva.redback.rbac.RbacObjectInvalidException)

Aggregations

RepositoryAdminException (org.apache.archiva.admin.model.RepositoryAdminException)11 AbstractRBACManager (org.apache.archiva.redback.rbac.AbstractRBACManager)11 RBACManager (org.apache.archiva.redback.rbac.RBACManager)11 RbacManagerException (org.apache.archiva.redback.rbac.RbacManagerException)11 RbacObjectInvalidException (org.apache.archiva.redback.rbac.RbacObjectInvalidException)11 RbacObjectNotFoundException (org.apache.archiva.redback.rbac.RbacObjectNotFoundException)11