Kantoor. Provisioning
(Kantoor v1.0.0)
What an external provisioning system may do to Kantoor, through the operator API
(/api/v1/provisioning, KantoorWeb.Provisioning). The modules are the same
contexts the admin screens use, restricted to what one operator created:
Kantoor.Provisioning.Domains: domains (the unit of a customer in Kantoor, which has no organisation level above it), their settings and seat limit, suspension, and the attachment to the mail source;Kantoor.Provisioning.Users: users, their mailbox grants and identities;Kantoor.Provisioning.Mailboxes: mailboxes;Kantoor.Provisioning.CalendarSubscriptions: external calendar feeds a user follows;Kantoor.Provisioning.Usage: counters for usage reporting;Kantoor.Provisioning.Idempotency: theIdempotency-Keystore.
Tenancy
Every function takes the Kantoor.ApiKeys.ApiKey as its first argument. A resource
belongs to the key's operator (domains.operator, users.operator); another
operator's resource, and one an admin made by hand, is :not_found, the same as one
that does not exist. Mailboxes belong to their domain, and a user can only be
granted mailboxes of its own domain.
Idempotent writes
A domain or a user is named by the caller's own reference (external_ref, unique per
operator in Postgres), a mailbox by its address. Creating what exists returns it
({:ok, resource, :existing}) and changes nothing; the unique indexes make this
hold when two requests race, on one replica or several. Creating something that
would clash with a different resource is a conflict, not a replay.
Suspension
Suspending a domain sets suspended_at, switches ingest off (and puts the Karta
route on hold) and disables its users with the reason domain_suspended; suspending
a user disables it with the reason provisioning. Disabled users cannot sign in on
the web, with IMAP, POP3 or DAV, and their sessions end; nothing is deleted. Resuming
undoes exactly that: a user that was also suspended on its own stays suspended.
Summary
Functions
The bytes of a non-negative integer or nil, as JSON sends them.
Whether ref is acceptable as an external reference (1 to 128 characters of A-Za-z0-9._:@-).