pub struct PermissionSet(/* private fields */);Expand description
Subsumption-aware permission collection.
Implementations§
Source§impl PermissionSet
impl PermissionSet
Sourcepub fn insert(&mut self, permission: Permission)
pub fn insert(&mut self, permission: Permission)
Insert one permission while keeping the set minimal.
A grant is dropped only when another grant Permission::subsumes it,
so an explicit gateway grant survives beside all in either order.
Sourcepub fn contains(&self, required: &Permission) -> bool
pub fn contains(&self, required: &Permission) -> bool
True if the set covers required.
Sourcepub fn contains_object_scoped(&self, required: &Permission) -> bool
pub fn contains_object_scoped(&self, required: &Permission) -> bool
True if a grant naming specific objects, not PermissionScope::All,
covers required.
A granted gateway deployment admits only such a grant, so the
unscoped invoke grant of the built-in Roles never reaches it.
Sourcepub fn covers_operation(&self, resource: &Resource, action: &Action) -> bool
pub fn covers_operation(&self, resource: &Resource, action: &Action) -> bool
True when the set grants action on resource under any object scope.
This is coarse admission, not authorization: it answers “does this
principal hold this capability at all”, which is what a public route
needs before it can resolve the objects a request actually touches. The
authoritative decision is Self::contains against the resolved
object, and no caller may substitute this for it.
Sourcepub fn intersection(
&self,
other: &Self,
) -> Result<Self, UnrepresentableIntersection>
pub fn intersection( &self, other: &Self, ) -> Result<Self, UnrepresentableIntersection>
The authority both sets grant: every permission covered by self and by
other, and nothing else.
Delegation mints with this so a delegated token can never carry more
than its caller holds. Each pair of grants meets axis by axis through the
same covers relations authorization uses: an AnyOf is split into its
members, each axis keeps the narrower side when one covers the other, and
a pair with a disjoint axis contributes nothing. A wildcard therefore
yields the other grant, and a schema grant meeting a table grant in that
schema yields the table grant.
The one meet no scope can state is all against an explicit gateway
grant: all reaches only open deployments, so their shared authority
is “that deployment, only while it is open”. Such a meet is accepted only
when the rest of the result already covers it — both sides also hold
all, or both grant the deployment explicitly; otherwise the complete
intersection is unrepresentable.
§Errors
Returns UnrepresentableIntersection naming the first gateway grant
whose shared authority depends on deployment access, so delegation can
refuse instead of widening or silently dropping it.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Permission>
pub fn iter(&self) -> impl Iterator<Item = &Permission>
Iterate over stored permissions.
Trait Implementations§
Source§impl Clone for PermissionSet
impl Clone for PermissionSet
Source§impl Debug for PermissionSet
impl Debug for PermissionSet
Source§impl Default for PermissionSet
impl Default for PermissionSet
Source§impl<'de> Deserialize<'de> for PermissionSet
impl<'de> Deserialize<'de> for PermissionSet
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 PermissionSet
Source§impl FromIterator<Permission> for PermissionSet
impl FromIterator<Permission> for PermissionSet
Source§fn from_iter<T: IntoIterator<Item = Permission>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Permission>>(iter: T) -> Self
Source§impl PartialEq for PermissionSet
impl PartialEq for PermissionSet
Source§impl Serialize for PermissionSet
impl Serialize for PermissionSet
impl StructuralPartialEq for PermissionSet
Auto Trait Implementations§
impl Freeze for PermissionSet
impl RefUnwindSafe for PermissionSet
impl Send for PermissionSet
impl Sync for PermissionSet
impl Unpin for PermissionSet
impl UnsafeUnpin for PermissionSet
impl UnwindSafe for PermissionSet
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
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.