pub struct GrantStore { /* private fields */ }Expand description
Read/write ~/.mur/agents/<name>/permissions/grants.yaml (0600,
atomic temp+rename) plus an append-only audit.jsonl.
Implementations§
Source§impl GrantStore
impl GrantStore
Sourcepub fn new<P: AsRef<Path>>(agent_dir: P) -> Self
pub fn new<P: AsRef<Path>>(agent_dir: P) -> Self
agent_dir is ~/.mur/agents/<name>/; this stores under
<agent_dir>/permissions/.
pub fn load(&mut self) -> Result<()>
Sourcepub fn lookup(
&self,
key: &ScopeKey,
now: DateTime<Utc>,
) -> Option<GrantDecision>
pub fn lookup( &self, key: &ScopeKey, now: DateTime<Utc>, ) -> Option<GrantDecision>
Returns the live Decision if the grant is present and not
expired; None otherwise (caller must AskUser or auto-Deny).
pub fn insert(&mut self, grant: Grant) -> Result<()>
pub fn revoke(&mut self, key: &ScopeKey, now: DateTime<Utc>) -> Result<()>
pub fn append_audit(&self, event: &AuditEvent) -> Result<()>
Auto Trait Implementations§
impl Freeze for GrantStore
impl RefUnwindSafe for GrantStore
impl Send for GrantStore
impl Sync for GrantStore
impl Unpin for GrantStore
impl UnsafeUnpin for GrantStore
impl UnwindSafe for GrantStore
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