Package com.io7m.idstore.database.api
Interface IdDatabaseAdminsQueriesType
- All Superinterfaces:
IdDatabaseQueriesType
The database queries involving admins.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
adminBanCreate
(IdBan ban) Create a ban on the given admin account.void
adminBanDelete
(IdBan ban) Delete the given ban.adminBanGet
(UUID id) Get the ban for the given admin, if one exists.default IdAdmin
adminCreate
(IdName idName, IdRealName realName, IdEmail email, IdPassword password, Set<IdAdminPermission> permissions) Create an admin.adminCreate
(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password, Set<IdAdminPermission> permissions) Create an admin.adminCreateInitial
(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password) Create an (initial) admin.void
adminDelete
(UUID id) Delete the given admin.void
adminEmailAdd
(UUID id, IdEmail email) Add an email address to the given admin.void
adminEmailRemove
(UUID id, IdEmail email) Remove an email address from the given admin.adminGetForEmail
(IdEmail email) adminGetForName
(IdName name) adminGetForNameRequire
(IdName name) adminGetRequire
(UUID id) void
adminLogin
(UUID id, Map<String, String> metadata) Record the fact that the given admin has logged in.adminSearch
(IdAdminSearchParameters parameters) List admins.adminSearchByEmail
(IdAdminSearchByEmailParameters parameters) List admins.void
adminUpdate
(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword, Optional<Set<IdAdminPermission>> withPermissions) Update the given admin.void
adminUpdateInitial
(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) Update the given (initial) admin.
-
Method Details
-
adminCreateInitial
IdAdmin adminCreateInitial(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password) throws IdDatabaseException Create an (initial) admin. This method behaves exactly the same asadminCreate(IdName, IdRealName, IdEmail, IdPassword, Set)
except that it does not require an existing admin account and does not write to the audit log. The method will fail if any admin account already exists,- Parameters:
id
- The admin IDidName
- The admin ID namerealName
- The admin real nameemail
- The admin emailcreated
- The creation timepassword
- The hashed password- Returns:
- The created admin
- Throws:
IdDatabaseException
- On errors
-
adminUpdateInitial
void adminUpdateInitial(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) throws IdDatabaseException Update the given (initial) admin. This method behaves exactly the same asadminUpdate(UUID, Optional, Optional, Optional, Optional)
except that it does not require an existing admin account and does not write to the audit log. The method will fail if the admin account either does not exist, or exists but is not the initial admin.- Parameters:
id
- The admin IDwithIdName
- The new ID name, if desiredwithRealName
- The new real name, if desiredwithPassword
- The new password, if desired- Throws:
IdDatabaseException
- On errors
-
adminCreate
@IdDatabaseRequiresAdmin default IdAdmin adminCreate(IdName idName, IdRealName realName, IdEmail email, IdPassword password, Set<IdAdminPermission> permissions) throws IdDatabaseException Create an admin.- Parameters:
idName
- The admin ID namerealName
- The admin real nameemail
- The admin emailpassword
- The hashed passwordpermissions
- The permissions the created admin will have- Returns:
- The created admin
- Throws:
IdDatabaseException
- On errors
-
adminCreate
@IdDatabaseRequiresAdmin IdAdmin adminCreate(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password, Set<IdAdminPermission> permissions) throws IdDatabaseException Create an admin.- Parameters:
id
- The admin IDidName
- The admin ID namerealName
- The admin real nameemail
- The admin emailcreated
- The creation timepassword
- The hashed passwordpermissions
- The permissions the created admin will have- Returns:
- The created admin
- Throws:
IdDatabaseException
- On errors
-
adminGet
- Parameters:
id
- The admin ID- Returns:
- A admin with the given ID
- Throws:
IdDatabaseException
- On errors
-
adminGetForName
- Parameters:
name
- The admin name- Returns:
- A admin with the given name
- Throws:
IdDatabaseException
- On errors
-
adminGetForNameRequire
- Parameters:
name
- The admin name- Returns:
- A admin with the given name
- Throws:
IdDatabaseException
- On errors
-
adminGetForEmail
- Parameters:
email
- The admin email- Returns:
- A admin with the given email
- Throws:
IdDatabaseException
- On errors
-
adminLogin
Record the fact that the given admin has logged in.- Parameters:
id
- The admin IDmetadata
- The login metadata- Throws:
IdDatabaseException
- On errors
-
adminSearch
IdDatabaseAdminSearchType adminSearch(IdAdminSearchParameters parameters) throws IdDatabaseException List admins.- Parameters:
parameters
- The search parameters- Returns:
- The admins
- Throws:
IdDatabaseException
- On errors
-
adminGetRequire
- Parameters:
id
- The admin ID- Returns:
- A admin with the given ID
- Throws:
IdDatabaseException
- On errors
-
adminEmailAdd
Add an email address to the given admin.- Parameters:
id
- The admin IDemail
- The new email- Throws:
IdDatabaseException
- On errors
-
adminEmailRemove
Remove an email address from the given admin.- Parameters:
id
- The admin IDemail
- The email- Throws:
IdDatabaseException
- On errors
-
adminUpdate
@IdDatabaseRequiresAdmin void adminUpdate(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword, Optional<Set<IdAdminPermission>> withPermissions) throws IdDatabaseException Update the given admin.- Parameters:
id
- The admin IDwithIdName
- The new ID name, if desiredwithRealName
- The new real name, if desiredwithPassword
- The new password, if desiredwithPermissions
- The new permissions, if desired- Throws:
IdDatabaseException
- On errors
-
adminDelete
Delete the given admin.- Parameters:
id
- The admin ID- Throws:
IdDatabaseException
- On errors
-
adminBanCreate
Create a ban on the given admin account.- Parameters:
ban
- The ban- Throws:
IdDatabaseException
- On errors
-
adminBanGet
Get the ban for the given admin, if one exists.- Parameters:
id
- The admin ID- Returns:
- The ban, if any
- Throws:
IdDatabaseException
- On errors
-
adminBanDelete
Delete the given ban.- Parameters:
ban
- The ban- Throws:
IdDatabaseException
- On errors
-
adminSearchByEmail
IdDatabaseAdminSearchByEmailType adminSearchByEmail(IdAdminSearchByEmailParameters parameters) throws IdDatabaseException List admins.- Parameters:
parameters
- The search parameters- Returns:
- The admins
- Throws:
IdDatabaseException
- On errors
-