Class UserRepository


  • public class UserRepository
    extends Object
    • Constructor Detail

      • UserRepository

        public UserRepository()
    • Method Detail

      • getUserId

        public static Integer getUserId​(String username)
        This expects username to be unique in the system!
        Parameters:
        username -
        jdbc -
        Returns:
        Throws:
        Exception
      • getUser

        public static Optional<de.narimo.commons.dto.User> getUser​(String username)
        This expects username to be unique in the system!
        Parameters:
        username -
        jdbc -
        Returns:
        Throws:
        Exception
      • createUser

        public static String createUser​(UserRegistrationDetails registrationDetails)
                                 throws IOException
        Creates a user and returns the alphanumeric secret that has been created for the user to validate his account. NOTE: This should work for a user, if his email is already registered but is marked as disabled!
        Parameters:
        email -
        organisation -
        userFirstName -
        userLastName -
        newPassword -
        Returns:
        Throws:
        IOException
      • getUsersById

        public static List<de.narimo.commons.dto.User> getUsersById​(List<Integer> userIds)
        Return all users by the specified ids.
        Parameters:
        adminIds -
        Returns:
      • confirmUserRegistration

        public static void confirmUserRegistration​(String email,
                                                   String registrationSecret)
                                            throws IOException
        Confirm a user registration in case a correct combination of email and registration secret has been provided. This combination must be unique to be accepted.
        Parameters:
        email -
        registrationSecret -
        Throws:
        IOException
      • setPasswordResetSecret

        public static String setPasswordResetSecret​(int userid,
                                                    String clientapp)
                                             throws IOException
        Set the secret for resetting the password and the client app which was used to issue the password reset request.
        Parameters:
        userid -
        clientapp -
        Returns:
        Throws:
        IOException
      • resetPassword

        public static String resetPassword​(String newPassword,
                                           String passwordResetSecret,
                                           String email)
                                    throws IOException
        Reset a password for a row that has been marked with a password reset secret before.
        Parameters:
        newPassword -
        passwordResetSecret -
        Throws:
        IOException
      • disableUser

        public static void disableUser​(int userid)
      • saveUser

        public static void saveUser​(int userid,
                                    de.narimo.commons.dto.RegistrationLanguage registrationLanguage)
      • incrementAllowedWorkspaceCount

        public static void incrementAllowedWorkspaceCount​(de.narimo.commons.dto.User user)