Search in sources :

Example 6 with UserManager

use of org.apache.archiva.redback.users.UserManager in project archiva by apache.

the class ArchivaConfigurableUsersManager method userExists.

@Override
public boolean userExists(String userName) throws UserManagerException {
    Exception lastException = null;
    boolean allFailed = true;
    boolean exists = false;
    for (UserManager userManager : userManagerPerId.values()) {
        try {
            if (userManager.userExists(userName)) {
                exists = true;
            }
            allFailed = false;
        } catch (Exception e) {
            lastException = e;
        }
    }
    if (lastException != null && allFailed) {
        throw new UserManagerException(lastException.getMessage(), lastException);
    }
    return exists;
}
Also used : UserManagerException(org.apache.archiva.redback.users.UserManagerException) AbstractUserManager(org.apache.archiva.redback.users.AbstractUserManager) UserManager(org.apache.archiva.redback.users.UserManager) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) UserManagerException(org.apache.archiva.redback.users.UserManagerException) UserNotFoundException(org.apache.archiva.redback.users.UserNotFoundException)

Example 7 with UserManager

use of org.apache.archiva.redback.users.UserManager in project archiva by apache.

the class ArchivaConfigurableUsersManager method updateUser.

@Override
public User updateUser(User user) throws UserNotFoundException, UserManagerException {
    UserManager userManager = userManagerPerId.get(user.getUserManagerId());
    user = userManager.updateUser(user);
    if (useUsersCache()) {
        usersCache.put(user.getUsername(), user);
    }
    return user;
}
Also used : AbstractUserManager(org.apache.archiva.redback.users.AbstractUserManager) UserManager(org.apache.archiva.redback.users.UserManager)

Example 8 with UserManager

use of org.apache.archiva.redback.users.UserManager in project archiva by apache.

the class ArchivaConfigurableUsersManager method createUser.

@Override
public User createUser(String username, String fullName, String emailAddress) throws UserManagerException {
    Exception lastException = null;
    boolean allFailed = true;
    User user = null;
    for (UserManager userManager : userManagerPerId.values()) {
        try {
            if (!userManager.isReadOnly()) {
                user = userManager.createUser(username, fullName, emailAddress);
                allFailed = false;
            }
        } catch (Exception e) {
            lastException = e;
        }
    }
    if (lastException != null && allFailed) {
        throw new UserManagerException(lastException.getMessage(), lastException);
    }
    return user;
}
Also used : User(org.apache.archiva.redback.users.User) UserManagerException(org.apache.archiva.redback.users.UserManagerException) AbstractUserManager(org.apache.archiva.redback.users.AbstractUserManager) UserManager(org.apache.archiva.redback.users.UserManager) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) UserManagerException(org.apache.archiva.redback.users.UserManagerException) UserNotFoundException(org.apache.archiva.redback.users.UserNotFoundException)

Example 9 with UserManager

use of org.apache.archiva.redback.users.UserManager in project archiva by apache.

the class ArchivaConfigurableUsersManager method deleteUser.

@Override
public void deleteUser(String username) throws UserNotFoundException, UserManagerException {
    Exception lastException = null;
    boolean allFailed = true;
    User user = null;
    for (UserManager userManager : userManagerPerId.values()) {
        try {
            if (!userManager.isReadOnly()) {
                userManager.deleteUser(username);
                allFailed = false;
            }
        } catch (Exception e) {
            lastException = e;
        }
    }
    if (lastException != null && allFailed) {
        throw new UserManagerException(lastException.getMessage(), lastException);
    }
}
Also used : User(org.apache.archiva.redback.users.User) UserManagerException(org.apache.archiva.redback.users.UserManagerException) AbstractUserManager(org.apache.archiva.redback.users.AbstractUserManager) UserManager(org.apache.archiva.redback.users.UserManager) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) UserManagerException(org.apache.archiva.redback.users.UserManagerException) UserNotFoundException(org.apache.archiva.redback.users.UserNotFoundException)

Example 10 with UserManager

use of org.apache.archiva.redback.users.UserManager in project archiva by apache.

the class ArchivaConfigurableUsersManager method createGuestUser.

@Override
public User createGuestUser() throws UserManagerException {
    Exception lastException = null;
    boolean allFailed = true;
    User user = null;
    for (UserManager userManager : userManagerPerId.values()) {
        try {
            if (!userManager.isReadOnly()) {
                user = userManager.createGuestUser();
                allFailed = false;
            }
        } catch (Exception e) {
            lastException = e;
        }
    }
    if (lastException != null && allFailed) {
        throw new UserManagerException(lastException.getMessage(), lastException);
    }
    return user;
}
Also used : User(org.apache.archiva.redback.users.User) UserManagerException(org.apache.archiva.redback.users.UserManagerException) AbstractUserManager(org.apache.archiva.redback.users.AbstractUserManager) UserManager(org.apache.archiva.redback.users.UserManager) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) UserManagerException(org.apache.archiva.redback.users.UserManagerException) UserNotFoundException(org.apache.archiva.redback.users.UserNotFoundException)

Aggregations

UserManager (org.apache.archiva.redback.users.UserManager)15 User (org.apache.archiva.redback.users.User)11 RepositoryAdminException (org.apache.archiva.admin.model.RepositoryAdminException)7 AbstractUserManager (org.apache.archiva.redback.users.AbstractUserManager)7 UserNotFoundException (org.apache.archiva.redback.users.UserNotFoundException)7 UserManagerException (org.apache.archiva.redback.users.UserManagerException)6 AuthenticationResult (org.apache.archiva.redback.authentication.AuthenticationResult)5 DefaultSecuritySession (org.apache.archiva.redback.system.DefaultSecuritySession)4 SecuritySession (org.apache.archiva.redback.system.SecuritySession)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 UnauthorizedException (org.apache.archiva.redback.authorization.UnauthorizedException)2 Map (java.util.Map)1 PostConstruct (javax.annotation.PostConstruct)1 AuthenticationException (org.apache.archiva.redback.authentication.AuthenticationException)1 AuthenticationFailureCause (org.apache.archiva.redback.authentication.AuthenticationFailureCause)1 PasswordBasedAuthenticationDataSource (org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource)1 AccountLockedException (org.apache.archiva.redback.policy.AccountLockedException)1 MustChangePasswordException (org.apache.archiva.redback.policy.MustChangePasswordException)1 PasswordEncoder (org.apache.archiva.redback.policy.PasswordEncoder)1