Ownership

enum class Ownership : Enum<Ownership>

Who an aggregate belongs to besides its tenant, as @AggregateRoot(ownership) declares it.

Every aggregate belongs to its tenant. Callers come at two levels: an owner-level caller (its scope has an owner) reads and writes only its own aggregates; a tenant-level caller (no owner) reads and writes every aggregate of its tenant, each action protected by action-level authorization (a part absent from the caller's scope is not checked).

Entries

Link copied to clipboard

The aggregate belongs to the owner of the command that creates it, when that command has one: an owner-level caller reads and writes it only when it is theirs. The default, such as an order or a basket.

Link copied to clipboard

The aggregate belongs to its tenant alone, such as a product every shopper reads: its owner is never recorded, a read is not restricted by the caller's owner, and a write is not checked against it. Its writes are protected by action-level authorization (CoSec). A space still applies.

Companion properties

Link copied to clipboard

Returns an immutable kotlin.enums.EnumEntries list containing the constants of this enum type, in the order they're declared.

Companion functions

Link copied to clipboard
fun valueOf(value: String): Ownership

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.

Functions

Link copied to clipboard
fun scopeOf(scope: Scope): Scope

The part of scope this ownership keeps: all of it for OWNER, its space alone for TENANT. It is what an aggregate created in scope records, and what a caller in scope is checked against.