pub struct PermissionStore {
pub tools: HashMap<String, PersistedDecision>,
}Fields§
§tools: HashMap<String, PersistedDecision>Per-tool decisions, keyed by tool name.
Implementations§
Source§impl PermissionStore
impl PermissionStore
Sourcepub fn load(config_dir: &PathBuf) -> PermissionStore
pub fn load(config_dir: &PathBuf) -> PermissionStore
Load from disk, or return an empty store if the file doesn’t exist.
Sourcepub fn is_tool_allowed(&self, tool_name: &str) -> bool
pub fn is_tool_allowed(&self, tool_name: &str) -> bool
Check if a tool has a persisted decision that allows it.
Sourcepub fn is_tool_denied(&self, tool_name: &str) -> bool
pub fn is_tool_denied(&self, tool_name: &str) -> bool
Check if a tool has a persisted decision that denies it.
Sourcepub fn get(&self, tool_name: &str) -> Option<&PersistedDecision>
pub fn get(&self, tool_name: &str) -> Option<&PersistedDecision>
Get the persisted decision for a tool, if any.
Sourcepub fn set_and_save(
&mut self,
tool_name: &str,
decision: &Decision,
config_dir: &PathBuf,
) -> Result<(), Error>
pub fn set_and_save( &mut self, tool_name: &str, decision: &Decision, config_dir: &PathBuf, ) -> Result<(), Error>
Set a decision for a tool and save to disk (only for durable decisions).
Sourcepub fn expire_session_scoped(&mut self)
pub fn expire_session_scoped(&mut self)
Remove session-only decisions (AllowOnce, AllowSession) — called at startup.
Sourcepub fn to_api_map(&self) -> HashMap<String, String>
pub fn to_api_map(&self) -> HashMap<String, String>
Convert to a JSON-serializable map for the WebView API.
Trait Implementations§
Source§impl Clone for PermissionStore
impl Clone for PermissionStore
Source§fn clone(&self) -> PermissionStore
fn clone(&self) -> PermissionStore
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 PermissionStore
impl Debug for PermissionStore
Source§impl Default for PermissionStore
impl Default for PermissionStore
Source§fn default() -> PermissionStore
fn default() -> PermissionStore
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PermissionStore
impl<'de> Deserialize<'de> for PermissionStore
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PermissionStore, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PermissionStore, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for PermissionStore
impl Serialize for PermissionStore
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto 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<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
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>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
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 more