pub struct AccountGate {
pub account: String,
pub reason: GateReason,
pub holder: String,
pub actor: String,
pub note: String,
pub at: UnixMillis,
pub expires: Option<UnixMillis>,
}Expand description
One account, locked.
Keyed in the identity table by AccountGate::account, which is a
principal id — and therefore also the namespace that principal
intrinsically owns (crate::AuthTable::owns_account). One row covers both
senses of “this user is locked out” because in gunnar they are the same
name.
Fields§
§account: StringThe principal id, which is also the account namespace.
reason: GateReasonWhy it is gated: somebody decided (GateReason::Administrative, no
deadline) or a purge holds it (GateReason::Purge, with expires).
holder: StringWho set it: a principal id for an operator, a job id for a purge. Read
back by crate::AuthTable::lift_gate_held_by, which is what stops a
finishing purge from lifting somebody else’s suspension.
actor: StringThe principal that asked, for the audit trail. A purge records the
principal that called Accounts.Purge, not the worker thread.
note: StringFree text, shown to the locked-out user. Not optional in practice: a refusal with no reason is a support ticket.
at: UnixMillisWhen it was set.
expires: Option<UnixMillis>None for an administrative gate — it never expires on its own.
Some for a purge lease; see PURGE_LEASE_MS.
Implementations§
Source§impl AccountGate
impl AccountGate
Sourcepub fn administrative(
account: impl Into<String>,
actor: impl Into<String>,
note: impl Into<String>,
) -> Self
pub fn administrative( account: impl Into<String>, actor: impl Into<String>, note: impl Into<String>, ) -> Self
A gate a person or a service set, with no deadline.
Sourcepub fn purge_lease(
account: impl Into<String>,
job_id: impl Into<String>,
expires: UnixMillis,
) -> Self
pub fn purge_lease( account: impl Into<String>, job_id: impl Into<String>, expires: UnixMillis, ) -> Self
A purge’s lease, expiring at expires.
Takes the deadline rather than computing now + PURGE_LEASE_MS so a
test can hand it a time in the past and see the expiry rule fire, which
is the only way to observe the property that keeps an account from being
bricked by a crash.
Sourcepub fn by(self, actor: impl Into<String>) -> Self
pub fn by(self, actor: impl Into<String>) -> Self
Record the principal that asked for the purge, for the audit trail.
Sourcepub fn noted(self, note: impl Into<String>) -> Self
pub fn noted(self, note: impl Into<String>) -> Self
Replace the note shown to the locked-out user.
Sourcepub fn is_live_at(&self, now: UnixMillis) -> bool
pub fn is_live_at(&self, now: UnixMillis) -> bool
Is this gate in force at now?
The one place the deadline is read, so an expired lease cannot be in force for the ACL and absent from the listing, or the other way round (one implementation).
Sourcepub fn is_live(&self) -> bool
pub fn is_live(&self) -> bool
AccountGate::is_live_at against the wall clock.
Trait Implementations§
Source§impl Clone for AccountGate
impl Clone for AccountGate
Source§impl Debug for AccountGate
impl Debug for AccountGate
Source§impl<'de> Deserialize<'de> for AccountGate
impl<'de> Deserialize<'de> for AccountGate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AccountGate
Source§impl PartialEq for AccountGate
impl PartialEq for AccountGate
Source§impl Serialize for AccountGate
impl Serialize for AccountGate
impl StructuralPartialEq for AccountGate
Auto Trait Implementations§
impl Freeze for AccountGate
impl RefUnwindSafe for AccountGate
impl Send for AccountGate
impl Sync for AccountGate
impl Unpin for AccountGate
impl UnsafeUnpin for AccountGate
impl UnwindSafe for AccountGate
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.