pub struct PermissionManager { /* private fields */ }Expand description
The permission manager
Implementations§
Source§impl PermissionManager
impl PermissionManager
Sourcepub fn new(policy: PermissionPolicy) -> Self
pub fn new(policy: PermissionPolicy) -> Self
Create a new permission manager with the given policy
Sourcepub fn set_prompt_callback(&self, callback: PermissionPromptCallback)
pub fn set_prompt_callback(&self, callback: PermissionPromptCallback)
Set the prompt callback for interactive mode
Sourcepub fn clear_prompt_callback(&self)
pub fn clear_prompt_callback(&self)
Clear the prompt callback
Sourcepub fn set_policy(&self, policy: PermissionPolicy)
pub fn set_policy(&self, policy: PermissionPolicy)
Update the security policy
Sourcepub fn security_level(&self) -> SecurityLevel
pub fn security_level(&self) -> SecurityLevel
Get the current security level
Sourcepub fn check_permission(
&self,
request: PermissionRequest,
) -> PermissionResult<PermissionResponse>
pub fn check_permission( &self, request: PermissionRequest, ) -> PermissionResult<PermissionResponse>
Check if an action is allowed, prompting if necessary
Sourcepub fn get_audit_log(&self) -> Vec<AuditEntry>
pub fn get_audit_log(&self) -> Vec<AuditEntry>
Get audit log entries
Sourcepub fn clear_audit_log(&self)
pub fn clear_audit_log(&self)
Clear audit log
Sourcepub fn cache_stats(&self) -> (usize, usize)
pub fn cache_stats(&self) -> (usize, usize)
Get cache statistics
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear permission cache
Sourcepub fn request_command(
&self,
command: &str,
args: Vec<String>,
) -> PermissionRequest
pub fn request_command( &self, command: &str, args: Vec<String>, ) -> PermissionRequest
Create a permission request for command execution
Sourcepub fn request_file_read(&self, path: &str) -> PermissionRequest
pub fn request_file_read(&self, path: &str) -> PermissionRequest
Create a permission request for file read
Sourcepub fn request_file_write(
&self,
path: &str,
content_preview: Option<&str>,
) -> PermissionRequest
pub fn request_file_write( &self, path: &str, content_preview: Option<&str>, ) -> PermissionRequest
Create a permission request for file write
Sourcepub fn request_file_delete(&self, path: &str) -> PermissionRequest
pub fn request_file_delete(&self, path: &str) -> PermissionRequest
Create a permission request for file delete
Sourcepub fn request_network(&self, url: &str, method: &str) -> PermissionRequest
pub fn request_network(&self, url: &str, method: &str) -> PermissionRequest
Create a permission request for network request
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PermissionManager
impl !RefUnwindSafe for PermissionManager
impl !UnwindSafe for PermissionManager
impl Send for PermissionManager
impl Sync for PermissionManager
impl Unpin for PermissionManager
impl UnsafeUnpin 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