pub struct PermissionModel { /* private fields */ }Expand description
Permission model for validating operations
Implementations§
Source§impl PermissionModel
impl PermissionModel
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new permission model with permissive default settings Allows all operations unless explicitly restricted by sandbox
Sourcepub fn with_sandbox(self, root: PathBuf) -> Self
pub fn with_sandbox(self, root: PathBuf) -> Self
Enable sandbox mode with a root directory
Sourcepub fn allow_read(self, path: PathBuf) -> Self
pub fn allow_read(self, path: PathBuf) -> Self
Add allowed read path
Sourcepub fn allow_write(self, path: PathBuf) -> Self
pub fn allow_write(self, path: PathBuf) -> Self
Add allowed write path
Sourcepub fn check_permission(
&self,
path: &Path,
permission: Permission,
) -> Result<()>
pub fn check_permission( &self, path: &Path, permission: Permission, ) -> Result<()>
Check if a path is allowed for the given permission
Sourcepub fn is_env_var_restricted(&self, var: &str) -> bool
pub fn is_env_var_restricted(&self, var: &str) -> bool
Check if environment variable is restricted
Trait Implementations§
Source§impl Clone for PermissionModel
impl Clone for PermissionModel
Source§fn clone(&self) -> PermissionModel
fn clone(&self) -> PermissionModel
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PermissionModel
impl Debug for PermissionModel
Auto Trait Implementations§
impl Freeze for PermissionModel
impl RefUnwindSafe for PermissionModel
impl Send for PermissionModel
impl Sync for PermissionModel
impl Unpin for PermissionModel
impl UnwindSafe for PermissionModel
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)