#[non_exhaustive]pub struct OwnershipRow {
pub id: String,
pub subject: Subject,
pub resource_kind: String,
pub resource_id: String,
pub relationship: String,
pub granted_by: PrincipalId,
pub on_behalf_of: Option<PrincipalId>,
pub granted_at: i64,
pub revoked_at: Option<i64>,
pub lease: Option<TupleLease>,
}Expand description
One row in the ownership table.
id is an opaque 128-bit identifier (UUIDv4 in the cheers-sqlx impls,
matching the existing mint_user_id shape — the doc spec calls for “ULID”
but the concrete crypto-random 128-bit shape is what’s load-bearing, not
the encoding).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: String§subject: SubjectWho holds the tuple. Serialized flat, as in NewOwnership: a
principal row keeps its principal_id key on the wire.
resource_kind: String§resource_id: String§relationship: String§granted_by: PrincipalId§on_behalf_of: Option<PrincipalId>§granted_at: i64§revoked_at: Option<i64>None while the row is live; the unix-second timestamp the soft delete
landed on once revoked. Rows with Some(_) are excluded from
list_for_principal.
lease: Option<TupleLease>The tuple’s lease, if it was admitted for a while (R734-F4).
Implementations§
Source§impl OwnershipRow
impl OwnershipRow
Sourcepub fn new(
id: String,
subject: Subject,
resource_kind: String,
resource_id: String,
relationship: String,
granted_by: PrincipalId,
on_behalf_of: Option<PrincipalId>,
granted_at: i64,
revoked_at: Option<i64>,
) -> Self
pub fn new( id: String, subject: Subject, resource_kind: String, resource_id: String, relationship: String, granted_by: PrincipalId, on_behalf_of: Option<PrincipalId>, granted_at: i64, revoked_at: Option<i64>, ) -> Self
Build a row from its constituent fields. Use from OwnershipStore
impls that need to assemble a row from a SQL query result.
Sourcepub fn with_lease(self, lease: Option<TupleLease>) -> Self
pub fn with_lease(self, lease: Option<TupleLease>) -> Self
Attach the stored lease.
Sourcepub fn is_live_at(&self, now: i64) -> bool
pub fn is_live_at(&self, now: i64) -> bool
true while the row confers its relation at now: not revoked and
not past its lease.
Sourcepub fn is_revoked(&self) -> bool
pub fn is_revoked(&self) -> bool
true iff the row has been soft-revoked.