Class UserTools
java.lang.Object
io.goobi.viewer.model.security.user.UserTools
Utility class providing static helper methods for user account management operations such as deleting a user and all associated data.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanMoves all public content from the given user to an anonymous user.static Userstatic intdeleteBookmarkListsForUser(User owner) static intdeleteSearchesForUser(User owner) static booleandeleteUser(User user) Deletes given user from the database and removes any database rows that reference this user (only those that are of use to this user - public content such as comments must be deleted separetely).static intdeleteUserGroupOwnedByUser(User owner) static voidDeletes all public content created by this the given user.static booleanisEmailInUse(String email, Long userId) static booleanisNicknameInUse(String nickname, Long userId)
-
Method Details
-
deleteUser
Deletes given user from the database and removes any database rows that reference this user (only those that are of use to this user - public content such as comments must be deleted separetely).- Parameters:
user- User to delete- Returns:
- true if successful; false otherwise
- Throws:
DAOException
-
deleteUserGroupOwnedByUser
- Parameters:
owner- Owner of groups to delete- Returns:
- Number of deleted user groups
- Throws:
DAOException
-
deleteBookmarkListsForUser
- Parameters:
owner- the user whose bookmark lists should be deleted- Returns:
- Number of deleted bookmark lists
- Throws:
DAOException
-
deleteSearchesForUser
- Parameters:
owner- the user whose saved searches should be deleted- Returns:
- Number of deleted searches
- Throws:
DAOException
-
deleteUserPublicContributions
Deletes all public content created by this the given user.- Parameters:
user- the user whose public contributions should be deleted- Throws:
DAOException
-
anonymizeUserPublicContributions
Moves all public content from the given user to an anonymous user.- Parameters:
user- the user whose public contributions should be anonymized- Returns:
- true if successful; false otherwise
- Throws:
DAOException
-
checkAndCreateAnonymousUser
- Returns:
- Created
User - Throws:
DAOException
-
isNicknameInUse
- Parameters:
nickname- the nickname to check for uniquenessuserId- the database ID of the user to exclude from the check- Returns:
- true if given nickname already in use by different user; false otherwise
- Throws:
DAOException
-
isEmailInUse
- Throws:
DAOException
-