Search in sources :

Example 6 with UserAssignment

use of org.apache.archiva.redback.rbac.UserAssignment in project archiva by apache.

the class AbstractSecurityTest method restoreGuestInitialValues.

protected void restoreGuestInitialValues(String userId) throws Exception {
    UserAssignment userAssignment = null;
    try {
        userAssignment = rbacManager.getUserAssignment(userId);
    } catch (RbacObjectNotFoundException e) {
        log.info("ignore RbacObjectNotFoundException for id {} during restoreGuestInitialValues", userId);
        return;
    }
    userAssignment.setRoleNames(Lists.newArrayList("Guest"));
    rbacManager.saveUserAssignment(userAssignment);
    CacheManager.getInstance().clearAll();
}
Also used : UserAssignment(org.apache.archiva.redback.rbac.UserAssignment) RbacObjectNotFoundException(org.apache.archiva.redback.rbac.RbacObjectNotFoundException)

Aggregations

UserAssignment (org.apache.archiva.redback.rbac.UserAssignment)6 RbacManagerException (org.apache.archiva.redback.rbac.RbacManagerException)5 RbacObjectNotFoundException (org.apache.archiva.redback.rbac.RbacObjectNotFoundException)4 ArrayList (java.util.ArrayList)3 RepositoryAdminException (org.apache.archiva.admin.model.RepositoryAdminException)3 AbstractRBACManager (org.apache.archiva.redback.rbac.AbstractRBACManager)3 RBACManager (org.apache.archiva.redback.rbac.RBACManager)3 RbacObjectInvalidException (org.apache.archiva.redback.rbac.RbacObjectInvalidException)3 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 ManagedRepositoryConfiguration (org.apache.archiva.configuration.ManagedRepositoryConfiguration)1 User (org.apache.archiva.redback.users.User)1 UserManager (org.apache.archiva.redback.users.UserManager)1 UserManagerException (org.apache.archiva.redback.users.UserManagerException)1 UserNotFoundException (org.apache.archiva.redback.users.UserNotFoundException)1