Kantoor.Accounts.User (Kantoor v1.0.0)

A person who signs in through the identity provider. Identified by the OIDC sub claim; the email is informational and is never used to link mailboxes.

Summary

Functions

Changeset for creating/updating a user from identity-provider claims.

Whether the user has been disabled.

Changeset for the user's own profile: display name, interface language (nil or empty means "use the browser's") and time zone (an IANA name, or empty for UTC). A display name edited here is no longer replaced by the identity provider's name at sign-in.

Changeset for a user made through the provisioning API. oidc_sub may be nil: the user is then invited, and the first verified sign-in with this email links it.

Whether a session that started at started_at (unix seconds) may still be used: it must have started after sessions_valid_after (sign out everywhere, disabling). A session that carries no identity-provider sid (the provider gave none, or it is older than sessions carrying it) must also have started after legacy_sessions_valid_after, which any notice that names a session sets: nothing can name such a session, so any notice ends it. A session with a sid is ended by its own notice only. A session without a start (an old cookie) is good only while the user has never been signed out.

Whether the user's access is suspended (through the API or with its domain), not just disabled.

Whether zone is an IANA time zone name the server knows.

Types

t()

@type t() :: %Kantoor.Accounts.User{
  __meta__: term(),
  app_passwords: term(),
  calendar_show_tasks: term(),
  disabled_at: term(),
  disabled_reason: term(),
  display_name: term(),
  display_name_locked: term(),
  domain: term(),
  domain_id: term(),
  email: term(),
  external_ref: term(),
  id: term(),
  inserted_at: term(),
  last_login_at: term(),
  legacy_sessions_valid_after: term(),
  locale: term(),
  mail_layout: term(),
  oidc_sub: term(),
  operator: term(),
  role: term(),
  sessions_valid_after: term(),
  share_free_busy: term(),
  sign_in_email: term(),
  tasks_view: term(),
  time_zone: term(),
  updated_at: term(),
  user_mailboxes: term()
}

Functions

claims_changeset(user, attrs)

Changeset for creating/updating a user from identity-provider claims.

disabled?(user)

Whether the user has been disabled.

profile_changeset(user, attrs)

Changeset for the user's own profile: display name, interface language (nil or empty means "use the browser's") and time zone (an IANA name, or empty for UTC). A display name edited here is no longer replaced by the identity provider's name at sign-in.

provisioning_changeset(user, attrs)

Changeset for a user made through the provisioning API. oidc_sub may be nil: the user is then invited, and the first verified sign-in with this email links it.

session_valid?(user, started_at, sid \\ nil)

@spec session_valid?(t(), integer() | nil, String.t() | nil) :: boolean()

Whether a session that started at started_at (unix seconds) may still be used: it must have started after sessions_valid_after (sign out everywhere, disabling). A session that carries no identity-provider sid (the provider gave none, or it is older than sessions carrying it) must also have started after legacy_sessions_valid_after, which any notice that names a session sets: nothing can name such a session, so any notice ends it. A session with a sid is ended by its own notice only. A session without a start (an old cookie) is good only while the user has never been signed out.

suspended?(user)

Whether the user's access is suspended (through the API or with its domain), not just disabled.

valid_time_zone?(zone)

Whether zone is an IANA time zone name the server knows.