Class UserTools

java.lang.Object
io.goobi.viewer.model.security.user.UserTools

public final class UserTools extends Object
Utility class providing static helper methods for user account management operations such as deleting a user and all associated data.
  • Method Details

    • deleteUser

      public static boolean deleteUser(User user) throws DAOException
      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

      public static int deleteUserGroupOwnedByUser(User owner) throws DAOException
      Parameters:
      owner - Owner of groups to delete
      Returns:
      Number of deleted user groups
      Throws:
      DAOException
    • deleteBookmarkListsForUser

      public static int deleteBookmarkListsForUser(User owner) throws DAOException
      Parameters:
      owner - the user whose bookmark lists should be deleted
      Returns:
      Number of deleted bookmark lists
      Throws:
      DAOException
    • deleteSearchesForUser

      public static int deleteSearchesForUser(User owner) throws DAOException
      Parameters:
      owner - the user whose saved searches should be deleted
      Returns:
      Number of deleted searches
      Throws:
      DAOException
    • deleteUserPublicContributions

      public static void deleteUserPublicContributions(User user) throws DAOException
      Deletes all public content created by this the given user.
      Parameters:
      user - the user whose public contributions should be deleted
      Throws:
      DAOException
    • anonymizeUserPublicContributions

      public static boolean anonymizeUserPublicContributions(User user) throws DAOException
      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

      public static User checkAndCreateAnonymousUser() throws DAOException
      Returns:
      Created User
      Throws:
      DAOException
    • isNicknameInUse

      public static boolean isNicknameInUse(String nickname, Long userId) throws DAOException
      Parameters:
      nickname - the nickname to check for uniqueness
      userId - 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

      public static boolean isEmailInUse(String email, Long userId) throws DAOException
      Throws:
      DAOException