pub struct PermissionStore { /* private fields */ }Expand description
In-memory mirror of the on-disk permissions file with load/save helpers.
Implementations§
Source§impl PermissionStore
impl PermissionStore
Sourcepub fn open_default() -> Result<Self>
pub fn open_default() -> Result<Self>
Open (or create) the permissions store at the default global path.
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open (or create) the permissions store at a specific path.
Sourcepub fn lookup(&self, extension_id: &str, capability: &str) -> Option<bool>
pub fn lookup(&self, extension_id: &str, capability: &str) -> Option<bool>
Look up a persisted decision for (extension_id, capability).
Returns Some(true) for allow, Some(false) for deny, None if no
decision is stored (or the stored decision has expired).
Sourcepub fn record(
&mut self,
extension_id: &str,
capability: &str,
allow: bool,
) -> Result<()>
pub fn record( &mut self, extension_id: &str, capability: &str, allow: bool, ) -> Result<()>
Record a decision and persist to disk.
Sourcepub fn record_with_version(
&mut self,
extension_id: &str,
capability: &str,
allow: bool,
version_range: &str,
) -> Result<()>
pub fn record_with_version( &mut self, extension_id: &str, capability: &str, allow: bool, version_range: &str, ) -> Result<()>
Record a decision with a version range constraint.
Sourcepub fn revoke_extension(&mut self, extension_id: &str) -> Result<()>
pub fn revoke_extension(&mut self, extension_id: &str) -> Result<()>
Remove all decisions for a specific extension.
Sourcepub const fn list(&self) -> &HashMap<String, HashMap<String, PersistedDecision>>
pub const fn list(&self) -> &HashMap<String, HashMap<String, PersistedDecision>>
List all persisted decisions grouped by extension.
Sourcepub fn to_cache_map(&self) -> HashMap<String, HashMap<String, bool>>
pub fn to_cache_map(&self) -> HashMap<String, HashMap<String, bool>>
Seed the in-memory cache of an ExtensionManager-style
HashMap<String, HashMap<String, bool>> from persisted decisions.
Only non-expired entries are included.
Sourcepub fn to_decision_cache(
&self,
) -> HashMap<String, HashMap<String, PersistedDecision>>
pub fn to_decision_cache( &self, ) -> HashMap<String, HashMap<String, PersistedDecision>>
Retrieve the full decision cache (including version ranges) for runtime enforcement.
Trait Implementations§
Source§impl Clone for PermissionStore
impl Clone for PermissionStore
Source§fn clone(&self) -> PermissionStore
fn clone(&self) -> PermissionStore
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PermissionStore
impl RefUnwindSafe for PermissionStore
impl Send for PermissionStore
impl Sync for PermissionStore
impl Unpin for PermissionStore
impl UnsafeUnpin for PermissionStore
impl UnwindSafe for PermissionStore
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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>
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 more