@Singleton
public class UserService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ADMIN_NAME
Default admin name; the admin user is created during the first initialization of JATOS; don't confuse admin user
with the Role ADMIN
|
static java.lang.String |
ADMIN_PASSWORD
Default admin password; the admin user is created during the first initialization of JATOS; don't confuse admin
user with the Role ADMIN
|
static java.lang.String |
ADMIN_USERNAME
Default admin username; the admin user is created during the first initialization of JATOS; don't confuse admin
user with the Role ADMIN
|
Modifier and Type | Method and Description |
---|---|
void |
bindToUserAndPersist(NewUserModel newUserModel)
Creates a user, sets password hash and persists him.
|
boolean |
changeAdminRole(java.lang.String normalizedUsername,
java.lang.Boolean admin)
Adds or removes ADMIN role of the user with the given username and persists the change.
|
boolean |
changeSuperuserRole(java.lang.String normalizedUsername,
boolean superuser)
Adds or removes SUPERUSER role of the user with the given username and persists the change.
|
void |
createAndPersistUser(User user,
java.lang.String password,
boolean adminRole,
User.AuthMethod authMethod)
Creates a user, sets password hash and persists them.
|
void |
removeUser(java.lang.String normalizedUsername)
Removes the User belonging to the given username from the database.
|
User |
retrieveUser(java.lang.String normalizedUsername)
Retrieves the user with the given username from the DB.
|
void |
setLastLogin(java.lang.String normalizedUsername) |
void |
setLastSeen(User user)
Sets the time of the last activity of the given user
|
void |
toggleActive(java.lang.String normalizedUsername,
boolean active) |
void |
updatePassword(User user,
java.lang.String newPassword)
Change password and persist user.
|
public static final java.lang.String ADMIN_USERNAME
public static final java.lang.String ADMIN_PASSWORD
public static final java.lang.String ADMIN_NAME
public User retrieveUser(java.lang.String normalizedUsername) throws NotFoundException
NotFoundException
public void bindToUserAndPersist(NewUserModel newUserModel)
public void createAndPersistUser(User user, java.lang.String password, boolean adminRole, User.AuthMethod authMethod)
public void updatePassword(User user, java.lang.String newPassword)
public void toggleActive(java.lang.String normalizedUsername, boolean active) throws NotFoundException, ForbiddenException
NotFoundException
ForbiddenException
public boolean changeSuperuserRole(java.lang.String normalizedUsername, boolean superuser) throws NotFoundException, ForbiddenException
NotFoundException
ForbiddenException
public boolean changeAdminRole(java.lang.String normalizedUsername, java.lang.Boolean admin) throws NotFoundException, ForbiddenException
NotFoundException
ForbiddenException
public void setLastLogin(java.lang.String normalizedUsername)
public void removeUser(java.lang.String normalizedUsername) throws NotFoundException, ForbiddenException, java.io.IOException
NotFoundException
ForbiddenException
java.io.IOException
public void setLastSeen(User user)