pub enum Subject<'a> {
Write {
account: &'a str,
attributes: SubjectAttributes<'a>,
universal: Universal<'a>,
client_id: Option<&'a ClientId>,
collection: &'a str,
action: WriteAction,
diff: Diff<'a>,
before: Option<&'a Value>,
after: Option<&'a Value>,
lookups: &'a [Lookup<'a>],
},
Blob {
account: &'a str,
attributes: SubjectAttributes<'a>,
universal: Universal<'a>,
client_id: Option<&'a ClientId>,
mime_type: &'a str,
sniffed: Option<&'a str>,
size: Option<u64>,
},
Grant {
universal: Universal<'a>,
client_id: &'a ClientId,
requested_scopes: &'a [&'a str],
},
Token {
account: &'a str,
attributes: SubjectAttributes<'a>,
universal: Universal<'a>,
client_id: &'a ClientId,
scopes: &'a [&'a str],
},
Create {
account: &'a str,
attributes: Option<SubjectAttributes<'a>>,
universal: Universal<'a>,
kind: SubjectKind<'a>,
asked: Asked,
pool: &'a str,
zone: &'a str,
name: Option<&'a str>,
label: Option<&'a str>,
},
}Expand description
What one policy is asked to decide about.
A client appears on all three variants, so a rule denying a client answers the same way at sign-in, at token issue, and at the write. The write matters most: a token issued before a denial still reaches it.
Variants§
Write
A write to this account’s own repository. Typically an agent’s, but
see AccountKind — the field is named for what it is, an account
DID, not for the kind that happens to be the common case.
Fields
attributes: SubjectAttributes<'a>Other attributes of that account a policy may reference — see
SubjectAttributes.
client_id: Option<&'a ClientId>The application whose OAuth token presented the write. None
when the account wrote with its own credential.
action: WriteActionCreate, update or delete — see WriteAction.
before: Option<&'a Value>The whole record as it was before this write, or None when the
key held nothing.
Diff::changes is the index key and says what moved; this is
the record itself. An evaluator that reads fields rather than
changed paths reads them from here, because a record cannot be
recovered from a diff: a path string is not a parse of the key
that produced it, so two different fields can spell the same
path, and an update’s diff names only the fields it touched.
Blob
A blob uploaded to this account. It is judged when the upload
starts, on what the request claims; at checkpoints while the body
arrives, each of which can refuse the upload but not admit it; and
once the bytes are in and before they are stored. A fact the first
judgment does not have is None — what is not known yet cannot deny.
Fields
attributes: SubjectAttributes<'a>Other attributes of that account — see SubjectAttributes.
client_id: Option<&'a ClientId>The application whose OAuth token presented the upload. None
when the account uploaded with its own credential.
Grant
A pushed authorization request, judged on the application and the scopes it asks for, before any account is known.
It names no account because it is asked before the request’s
login_hint is resolved, which is what keeps a client the gate
refuses indistinguishable from a hint naming nobody — so only a
policy bound to the whole server reaches it. A rule about one
account is asked where the account is known: Subject::Token, on
every token issue and every rotation, and Subject::Write.
Fields
Token
A token about to be issued to an application for an account: an authorization code exchanged, or a refresh token rotated.
Fields
attributes: SubjectAttributes<'a>Other attributes of that account — see SubjectAttributes.
Create
Where a new account lands: account.create, asked once for each
pool and zone a create could land in, before a name is made.
Fields
account: &'a strThe account creating it. The operator’s own create names the operator’s DID, which this server does not host.
attributes: Option<SubjectAttributes<'a>>Other attributes of the creating account, when this server
hosts it — see SubjectAttributes.
kind: SubjectKind<'a>What the new account is.
Implementations§
Source§impl Subject<'_>
impl Subject<'_>
Trait Implementations§
Source§impl<'a> PartialEq for Subject<'a>
impl<'a> PartialEq for Subject<'a>
impl<'a> Copy for Subject<'a>
impl<'a> Eq for Subject<'a>
impl<'a> StructuralPartialEq for Subject<'a>
Auto Trait Implementations§
impl<'a> Freeze for Subject<'a>
impl<'a> RefUnwindSafe for Subject<'a>
impl<'a> Send for Subject<'a>
impl<'a> Sync for Subject<'a>
impl<'a> Unpin for Subject<'a>
impl<'a> UnsafeUnpin for Subject<'a>
impl<'a> UnwindSafe for Subject<'a>
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.