pub enum PrincipalKind {
User,
Machine,
Deploy,
Group,
Anonymous,
}Expand description
What kind of thing an identity is.
The distinction is not decorative: a Deploy key is expected to be
read-only and short-lived, and a UI that cannot tell a human from a CI
runner cannot show a useful key list.
Variants§
User
A person.
Machine
A machine account: CI, a bot, another service.
Deploy
A deploy key: one repository, usually read-only.
Group
A group of principals (punkt 9).
A group is a principal like any other — it has an id, it can be the
grantee of a Grant at any scope and level, and grant/revoke/may
treat it no differently from a user (one implementation, no new grant type). What is
special is only that it holds no keys and is never authenticated as:
a group is a name that grants attach to, and the members of the group
inherit those grants. Membership is an edge, tracked beside the identity
table (AuthTable::add_to_group), not a field on the principal, so the
same principal record serves a group and a user.
Anonymous
Nobody. The caller presented no key at all.
There is exactly one principal of this kind, Principal::anonymous.
It is never stored in the identity table, it can never hold a key and it
can never hold a grant. It exists so that “a stranger clones a public
repository” is answered by AuthTable::may
like every other access question, rather than by a second code path
that could disagree with the first (one implementation).
Trait Implementations§
Source§impl Clone for PrincipalKind
impl Clone for PrincipalKind
impl Copy for PrincipalKind
Source§impl Debug for PrincipalKind
impl Debug for PrincipalKind
Source§impl<'de> Deserialize<'de> for PrincipalKind
impl<'de> Deserialize<'de> for PrincipalKind
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 PrincipalKind
Source§impl Hash for PrincipalKind
impl Hash for PrincipalKind
Source§impl Ord for PrincipalKind
impl Ord for PrincipalKind
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PrincipalKind
impl PartialEq for PrincipalKind
Source§impl PartialOrd for PrincipalKind
impl PartialOrd for PrincipalKind
Source§impl Serialize for PrincipalKind
impl Serialize for PrincipalKind
impl StructuralPartialEq for PrincipalKind
Auto Trait Implementations§
impl Freeze for PrincipalKind
impl RefUnwindSafe for PrincipalKind
impl Send for PrincipalKind
impl Sync for PrincipalKind
impl Unpin for PrincipalKind
impl UnsafeUnpin for PrincipalKind
impl UnwindSafe for PrincipalKind
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.