Package de.narimo.geocore.ws.repository
Class UserRepository
- java.lang.Object
-
- de.narimo.geocore.ws.repository.UserRepository
-
public class UserRepository extends Object
-
-
Constructor Summary
Constructors Constructor Description UserRepository()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanUserCreateWorkspace(long userId)static voidconfirmUserRegistration(String email, String registrationSecret)Confirm a user registration in case a correct combination of email and registration secret has been provided.static StringcreateUser(UserRegistrationDetails registrationDetails)Creates a user and returns the alphanumeric secret that has been created for the user to validate his account.static voiddisableUser(int userid)static Optional<de.narimo.commons.dto.User>getUser(String username)This expects username to be unique in the system!static IntegergetUserId(String username)This expects username to be unique in the system!static List<de.narimo.commons.dto.User>getUsersById(List<Integer> userIds)Return all users by the specified ids.static voidresetPassword(String newPassword, String passwordResetSecret, String email)Reset a password for a row that has been marked with a password reset secret before.static voidsaveUser(int userid, de.narimo.commons.dto.RegistrationLanguage registrationLanguage)static StringsetPasswordResetSecret(int userid)
-
-
-
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) throws IOException
- Throws:
IOException
-
resetPassword
public static void 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
-
canUserCreateWorkspace
public static boolean canUserCreateWorkspace(long userId)
-
disableUser
public static void disableUser(int userid)
-
saveUser
public static void saveUser(int userid, de.narimo.commons.dto.RegistrationLanguage registrationLanguage)
-
-