pub struct PermissionManager { /* private fields */ }Expand description
Permission management service
Implementations§
Source§impl PermissionManager
impl PermissionManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new permission manager.
Loads persisted permissions from ~/.config/gestura/permissions.json (or
the platform equivalent). The audit log is kept in-memory only.
Sourcepub fn from_config_path(config_path: PathBuf) -> Self
pub fn from_config_path(config_path: PathBuf) -> Self
Create a permission manager backed by an explicit config path.
This is useful for tests and isolated runtimes that must avoid reading or writing the default user-scoped permissions file.
Sourcepub fn audit_log(&self) -> Result<Vec<PermissionAuditEntry>>
pub fn audit_log(&self) -> Result<Vec<PermissionAuditEntry>>
Return a snapshot of the permission audit log.
Sourcepub fn clear_audit_log(&self) -> Result<usize>
pub fn clear_audit_log(&self) -> Result<usize>
Clear the permission audit log.
Returns the number of entries removed.
Sourcepub fn list(&self) -> Result<Vec<Permission>>
pub fn list(&self) -> Result<Vec<Permission>>
List all permissions
Sourcepub fn grant(
&self,
tool: &str,
action: &str,
scope: PermissionScope,
ttl_secs: Option<u64>,
) -> Result<Permission>
pub fn grant( &self, tool: &str, action: &str, scope: PermissionScope, ttl_secs: Option<u64>, ) -> Result<Permission>
Grant a permission
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PermissionManager
impl RefUnwindSafe for PermissionManager
impl Send for PermissionManager
impl Sync for PermissionManager
impl Unpin for PermissionManager
impl UnwindSafe for PermissionManager
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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().