pub struct PermissionMetadataSet {
entries: Vec<PermissionMetadataEntry>,
sources: Vec<PermissionResolutionSource>,
}Expand description
A flat effective permission metadata set.
Fields§
§entries: Vec<PermissionMetadataEntry>§sources: Vec<PermissionResolutionSource>Implementations§
Source§impl PermissionMetadataSet
impl PermissionMetadataSet
Sourcepub fn from_entries(
entries: impl IntoIterator<Item = PermissionMetadataEntry>,
) -> Self
pub fn from_entries( entries: impl IntoIterator<Item = PermissionMetadataEntry>, ) -> Self
Creates a subject metadata set from entries.
Sourcepub fn entries(&self) -> &[PermissionMetadataEntry]
pub fn entries(&self) -> &[PermissionMetadataEntry]
Returns all entries in insertion order.
Sourcepub fn push(&mut self, entry: PermissionMetadataEntry)
pub fn push(&mut self, entry: PermissionMetadataEntry)
Adds one subject metadata rule.
Sourcepub fn set(&mut self, key: Identifier, value: PermissionMetadataValue)
pub fn set(&mut self, key: Identifier, value: PermissionMetadataValue)
Sets one exact global value, replacing any previous exact value.
Sourcepub fn set_in(
&mut self,
key: Identifier,
context: PermissionRuleContext,
value: PermissionMetadataValue,
)
pub fn set_in( &mut self, key: Identifier, context: PermissionRuleContext, value: PermissionMetadataValue, )
Sets one exact contextual value, replacing any previous exact value.
Sourcepub fn unset(&mut self, key: &Identifier) -> bool
pub fn unset(&mut self, key: &Identifier) -> bool
Removes one exact global value.
Sourcepub fn unset_in(
&mut self,
key: &Identifier,
context: &PermissionRuleContext,
) -> bool
pub fn unset_in( &mut self, key: &Identifier, context: &PermissionRuleContext, ) -> bool
Removes one exact contextual value.
Sourcepub fn resolve(&self, key: &Identifier) -> Option<&PermissionMetadataValue>
pub fn resolve(&self, key: &Identifier) -> Option<&PermissionMetadataValue>
Resolves one value in the global context.
Sourcepub fn resolve_in(
&self,
key: &Identifier,
context: &PermissionContext,
) -> Option<&PermissionMetadataValue>
pub fn resolve_in( &self, key: &Identifier, context: &PermissionContext, ) -> Option<&PermissionMetadataValue>
Resolves one value in an active permission context.
More-specific contexts win. Ties prefer subject metadata, then group priority, then the final insertion order for deterministic resolution.
Sourcepub fn resolve_detailed(
&self,
key: &Identifier,
) -> Option<PermissionMetadataResolution>
pub fn resolve_detailed( &self, key: &Identifier, ) -> Option<PermissionMetadataResolution>
Resolves one global value and returns the winning rule.
Sourcepub fn resolve_in_detailed(
&self,
key: &Identifier,
context: &PermissionContext,
) -> Option<PermissionMetadataResolution>
pub fn resolve_in_detailed( &self, key: &Identifier, context: &PermissionContext, ) -> Option<PermissionMetadataResolution>
Resolves one contextual value and returns the winning rule.
pub(super) fn push_group( &mut self, entry: PermissionMetadataEntry, group: &str, group_priority: i32, )
fn push_with_source( &mut self, entry: PermissionMetadataEntry, source: PermissionResolutionSource, )
fn retain_entries(&mut self, keep: impl FnMut(&PermissionMetadataEntry) -> bool)
fn best_candidate( &self, key: &Identifier, context: &PermissionContext, ) -> Option<PermissionMetadataCandidate>
fn resolution( &self, candidate: PermissionMetadataCandidate, ) -> PermissionMetadataResolution
Trait Implementations§
Source§impl Clone for PermissionMetadataSet
impl Clone for PermissionMetadataSet
Source§fn clone(&self) -> PermissionMetadataSet
fn clone(&self) -> PermissionMetadataSet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PermissionMetadataSet
impl Debug for PermissionMetadataSet
Source§impl Default for PermissionMetadataSet
impl Default for PermissionMetadataSet
Source§fn default() -> PermissionMetadataSet
fn default() -> PermissionMetadataSet
Returns the “default value” for a type. Read more
impl Eq for PermissionMetadataSet
Source§impl PartialEq for PermissionMetadataSet
impl PartialEq for PermissionMetadataSet
impl StructuralPartialEq for PermissionMetadataSet
Auto Trait Implementations§
impl Freeze for PermissionMetadataSet
impl RefUnwindSafe for PermissionMetadataSet
impl Send for PermissionMetadataSet
impl Sync for PermissionMetadataSet
impl Unpin for PermissionMetadataSet
impl UnsafeUnpin for PermissionMetadataSet
impl UnwindSafe for PermissionMetadataSet
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
Mutably borrows from an owned value. Read more
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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key and return true if they are equal.§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
Compares
self with key and returns true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>