pub enum Permission {
FileSystemRead,
FileSystemWrite,
FileSystemDelete,
NetworkAccess,
SystemCommands,
ProcessSpawn,
GpuAccess,
EnvironmentVariables,
SystemConfiguration,
Custom(String),
}Expand description
Plugin permission types
Permissions define what system resources and capabilities a plugin requires to function. They are used for security validation and user consent workflows.
§Permission Categories
- File System: Read, write, and delete file operations
- Network: Internet and local network access
- System: Process execution and system command access
- Hardware: GPU and specialized hardware access
- Environment: Access to environment variables and system settings
§Examples
use sklears_core::plugin::Permission;
// Standard permissions
let read_perm = Permission::FileSystemRead;
let write_perm = Permission::FileSystemWrite;
let network_perm = Permission::NetworkAccess;
// Custom permission
let custom_perm = Permission::Custom("database_access".to_string());Variants§
FileSystemRead
Read access to file system
FileSystemWrite
Write access to file system
FileSystemDelete
Delete access to file system
NetworkAccess
Access to network resources
SystemCommands
Execute system commands
ProcessSpawn
Spawn new processes
GpuAccess
Access to GPU resources
EnvironmentVariables
Access to environment variables
SystemConfiguration
Access to system configuration
Custom(String)
Custom permission with user-defined name
Implementations§
Source§impl Permission
impl Permission
Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Sourcepub fn risk_level(&self) -> u8
pub fn risk_level(&self) -> u8
Sourcepub fn requires_user_consent(&self) -> bool
pub fn requires_user_consent(&self) -> bool
Check if this permission requires user consent
§Returns
true if user consent is required, false otherwise.
Sourcepub fn all_standard() -> Vec<Permission>
pub fn all_standard() -> Vec<Permission>
Trait Implementations§
Source§impl Clone for Permission
impl Clone for Permission
Source§fn clone(&self) -> Permission
fn clone(&self) -> Permission
Returns a duplicate of the value. Read more
1.0.0 · 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 Permission
impl Debug for Permission
Source§impl<'de> Deserialize<'de> for Permission
impl<'de> Deserialize<'de> for Permission
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for Permission
impl Hash for Permission
Source§impl PartialEq for Permission
impl PartialEq for Permission
Source§impl Serialize for Permission
impl Serialize for Permission
impl Eq for Permission
impl StructuralPartialEq for Permission
Auto Trait Implementations§
impl Freeze for Permission
impl RefUnwindSafe for Permission
impl Send for Permission
impl Sync for Permission
impl Unpin for Permission
impl UnwindSafe for Permission
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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