Package com.io7m.idstore.database.api

# Interface IdDatabaseAdminsQueriesType

All Superinterfaces:
  `IdDatabaseQueriesType`

public non-sealed interface IdDatabaseAdminsQueriesType extends IdDatabaseQueriesType
The database queries involving admins.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `adminBanCreate(IdBan ban)`
  Create a ban on the given admin account.
  `void`
  `adminBanDelete(IdBan ban)`
  Delete the given ban.
  `Optional<IdBan>`
  `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.
  `IdAdmin`
  `adminCreate(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password, Set<IdAdminPermission> permissions)`
  Create an admin.
  `IdAdmin`
  `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.
  `Optional<IdAdmin>`
  `adminGet(UUID id)`
  `Optional<IdAdmin>`
  `adminGetForEmail(IdEmail email)`
  `Optional<IdAdmin>`
  `adminGetForName(IdName name)`
  `IdAdmin`
  `adminGetForNameRequire(IdName name)`
  `IdAdmin`
  `adminGetRequire(UUID id)`
  `void`
  `adminLogin(UUID id, Map<String,String> metadata)`
  Record the fact that the given admin has logged in.
  `IdDatabaseAdminSearchType`
  `adminSearch(IdAdminSearchParameters parameters)`
  List admins.
  `IdDatabaseAdminSearchByEmailType`
  `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 as `adminCreate(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 ID
      `created` - The creation time
      `idName` - The admin ID name
      `realName` - The admin real name
      `email` - The admin email
      `password` - 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 as `adminUpdate(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 ID
      `withIdName` - The new ID name, if desired
      `withRealName` - The new real name, if desired
      `withPassword` - 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 name
      `realName` - The admin real name
      `email` - The admin email
      `password` - The hashed password
      `permissions` - 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 ID
      `created` - The creation time
      `idName` - The admin ID name
      `realName` - The admin real name
      `email` - The admin email
      `password` - The hashed password
      `permissions` - The permissions the created admin will have
    Returns:
      The created admin
    Throws:
      `IdDatabaseException` - On errors

  - ### adminGet

    Optional<IdAdmin> adminGet(UUID id) throws IdDatabaseException
    Parameters:
      `id` - The admin ID
    Returns:
      A admin with the given ID
    Throws:
      `IdDatabaseException` - On errors

  - ### adminGetForName

    Optional<IdAdmin> adminGetForName(IdName name) throws IdDatabaseException
    Parameters:
      `name` - The admin name
    Returns:
      A admin with the given name
    Throws:
      `IdDatabaseException` - On errors

  - ### adminGetForNameRequire

    IdAdmin adminGetForNameRequire(IdName name) throws IdDatabaseException
    Parameters:
      `name` - The admin name
    Returns:
      A admin with the given name
    Throws:
      `IdDatabaseException` - On errors

  - ### adminGetForEmail

    Optional<IdAdmin> adminGetForEmail(IdEmail email) throws IdDatabaseException
    Parameters:
      `email` - The admin email
    Returns:
      A admin with the given email
    Throws:
      `IdDatabaseException` - On errors

  - ### adminLogin

    void adminLogin(UUID id, Map<String,String> metadata) throws IdDatabaseException
    Record the fact that the given admin has logged in.
    Parameters:
      `id` - The admin ID
      `metadata` - 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

    IdAdmin adminGetRequire(UUID id) throws IdDatabaseException
    Parameters:
      `id` - The admin ID
    Returns:
      A admin with the given ID
    Throws:
      `IdDatabaseException` - On errors

  - ### adminEmailAdd

    void adminEmailAdd(UUID id, IdEmail email) throws IdDatabaseException
    Add an email address to the given admin.
    Parameters:
      `id` - The admin ID
      `email` - The new email
    Throws:
      `IdDatabaseException` - On errors

  - ### adminEmailRemove

    void adminEmailRemove(UUID id, IdEmail email) throws IdDatabaseException
    Remove an email address from the given admin.
    Parameters:
      `id` - The admin ID
      `email` - 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 ID
      `withIdName` - The new ID name, if desired
      `withRealName` - The new real name, if desired
      `withPassword` - The new password, if desired
      `withPermissions` - The new permissions, if desired
    Throws:
      `IdDatabaseException` - On errors

  - ### adminDelete

    @IdDatabaseRequiresAdmin void adminDelete(UUID id) throws IdDatabaseException
    Delete the given admin.
    Parameters:
      `id` - The admin ID
    Throws:
      `IdDatabaseException` - On errors

  - ### adminBanCreate

    @IdDatabaseRequiresAdmin void adminBanCreate(IdBan ban) throws IdDatabaseException
    Create a ban on the given admin account.
    Parameters:
      `ban` - The ban
    Throws:
      `IdDatabaseException` - On errors

  - ### adminBanGet

    Optional<IdBan> adminBanGet(UUID id) throws IdDatabaseException
    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

    @IdDatabaseRequiresAdmin void adminBanDelete(IdBan ban) throws IdDatabaseException
    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