Package com.io7m.idstore.database.api
Interface IdDatabaseUsersQueriesType
- All Superinterfaces:
IdDatabaseQueriesType
The database queries involving users.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
userBanCreate
(IdBan ban) Create a ban on the given user account.void
userBanDelete
(IdBan ban) Delete the given ban.userBanGet
(UUID id) Get the ban for the given user, if one exists.default IdUser
userCreate
(IdName idName, IdRealName realName, IdEmail email, IdPassword password) Create a user.userCreate
(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password) Create a user.void
userDelete
(UUID id) Delete the given user.void
userEmailAdd
(UUID id, IdEmail email) Add an email address to the given user.void
userEmailRemove
(UUID id, IdEmail email) Remove an email address from the given user.userGetForEmail
(IdEmail email) userGetForEmailRequire
(IdEmail email) userGetForName
(IdName name) userGetForNameRequire
(IdName name) userGetRequire
(UUID id) void
Record the fact that the given user has logged in.userLoginHistory
(UUID id, int limit) Obtain the login history of the given user.void
Create a password reset request.void
Delete a password reset request.userPasswordResetGet
(UUID user) List the password reset requests for the given user.List the password reset request for the given token.userSearch
(IdUserSearchParameters parameters) List users.userSearchByEmail
(IdUserSearchByEmailParameters parameters) List users.void
userUpdate
(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) Update the given user.void
userUpdateAsAdmin
(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) Update the given user as an admin.
-
Method Details
-
userCreate
@IdDatabaseRequiresUser default IdUser userCreate(IdName idName, IdRealName realName, IdEmail email, IdPassword password) throws IdDatabaseException Create a user.- Parameters:
idName
- The ID namerealName
- The real nameemail
- The user emailpassword
- The hashed password- Returns:
- The created user
- Throws:
IdDatabaseException
- On errors
-
userCreate
@IdDatabaseRequiresAdmin IdUser userCreate(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password) throws IdDatabaseException Create a user.- Parameters:
id
- The user IDidName
- The ID namerealName
- The real nameemail
- The user emailcreated
- The creation timepassword
- The hashed password- Returns:
- The created user
- Throws:
IdDatabaseException
- On errors
-
userGet
- Parameters:
id
- The user ID- Returns:
- A user with the given ID
- Throws:
IdDatabaseException
- On errors
-
userGetRequire
- Parameters:
id
- The user ID- Returns:
- A user with the given ID
- Throws:
IdDatabaseException
- On errors
-
userGetForName
- Parameters:
name
- The ID name- Returns:
- A user with the given name
- Throws:
IdDatabaseException
- On errors
-
userGetForNameRequire
- Parameters:
name
- The ID name- Returns:
- A user with the given name
- Throws:
IdDatabaseException
- On errors
-
userGetForEmail
- Parameters:
email
- The user email- Returns:
- A user with the given email
- Throws:
IdDatabaseException
- On errors
-
userGetForEmailRequire
- Parameters:
email
- The user email- Returns:
- A user with the given email
- Throws:
IdDatabaseException
- On errors
-
userLogin
Record the fact that the given user has logged in.- Parameters:
id
- The user IDmetadata
- The optional metadata included with the requestlimitHistory
- The limit on the number of login records that will be kept- Throws:
IdDatabaseException
- On errors
-
userUpdate
@IdDatabaseRequiresUser void userUpdate(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) throws IdDatabaseException Update the given user.- Parameters:
id
- The user IDwithIdName
- The new ID name, if desiredwithRealName
- The new real name, if desiredwithPassword
- The new password, if desired- Throws:
IdDatabaseException
- On errors
-
userUpdateAsAdmin
@IdDatabaseRequiresAdmin void userUpdateAsAdmin(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) throws IdDatabaseException Update the given user as an admin.- Parameters:
id
- The user IDwithIdName
- The new ID name, if desiredwithRealName
- The new real name, if desiredwithPassword
- The new password, if desired- Throws:
IdDatabaseException
- On errors
-
userEmailAdd
Add an email address to the given user.- Parameters:
id
- The user IDemail
- The new email- Throws:
IdDatabaseException
- On errors
-
userEmailRemove
Remove an email address from the given user.- Parameters:
id
- The user IDemail
- The email- Throws:
IdDatabaseException
- On errors
-
userLoginHistory
Obtain the login history of the given user.- Parameters:
id
- The user IDlimit
- The limit on the number of returned items- Returns:
- The login history
- Throws:
IdDatabaseException
- On errors
-
userDelete
Delete the given user.- Parameters:
id
- The user ID- Throws:
IdDatabaseException
- On errors
-
userBanCreate
Create a ban on the given user account.- Parameters:
ban
- The ban- Throws:
IdDatabaseException
- On errors
-
userBanGet
Get the ban for the given user, if one exists.- Parameters:
id
- The user ID- Returns:
- The ban, if any
- Throws:
IdDatabaseException
- On errors
-
userBanDelete
Delete the given ban.- Parameters:
ban
- The ban- Throws:
IdDatabaseException
- On errors
-
userPasswordResetCreate
Create a password reset request.- Parameters:
reset
- The request- Throws:
IdDatabaseException
- On errors
-
userPasswordResetGet
List the password reset requests for the given user.- Parameters:
user
- The user- Returns:
- A list of requests, if any
- Throws:
IdDatabaseException
- On errors
-
userPasswordResetGetForToken
Optional<IdUserPasswordReset> userPasswordResetGetForToken(IdToken token) throws IdDatabaseException List the password reset request for the given token.- Parameters:
token
- The token- Returns:
- A request, if any
- Throws:
IdDatabaseException
- On errors
-
userPasswordResetDelete
Delete a password reset request.- Parameters:
reset
- The request- Throws:
IdDatabaseException
- On errors
-
userSearch
List users.- Parameters:
parameters
- The search parameters- Returns:
- The users
- Throws:
IdDatabaseException
- On errors
-
userSearchByEmail
IdDatabaseUserSearchByEmailType userSearchByEmail(IdUserSearchByEmailParameters parameters) throws IdDatabaseException List users.- Parameters:
parameters
- The search parameters- Returns:
- The users
- Throws:
IdDatabaseException
- On errors
-