pub struct PermissionContext {
pub user_id: String,
pub session_id: String,
pub working_dir: PathBuf,
pub resource: String,
pub operation: String,
pub params: HashMap<String, Value>,
pub current_level: PermissionLevel,
}Expand description
Context for permission evaluation
Fields§
§user_id: StringUser or session identifier
session_id: StringSession identifier
working_dir: PathBufCurrent working directory
resource: StringRequested resource
operation: StringRequested operation
params: HashMap<String, Value>Additional context parameters
current_level: PermissionLevelCurrent permission level
Implementations§
Source§impl PermissionContext
impl PermissionContext
Sourcepub fn new(
user_id: String,
session_id: String,
working_dir: PathBuf,
resource: String,
operation: String,
) -> Self
pub fn new( user_id: String, session_id: String, working_dir: PathBuf, resource: String, operation: String, ) -> Self
Create a new permission context
Sourcepub fn with_param<K, V>(self, key: K, value: V) -> Self
pub fn with_param<K, V>(self, key: K, value: V) -> Self
Add a parameter to the context
Sourcepub fn with_level(self, level: PermissionLevel) -> Self
pub fn with_level(self, level: PermissionLevel) -> Self
Set the current permission level
Trait Implementations§
Source§impl Clone for PermissionContext
impl Clone for PermissionContext
Source§fn clone(&self) -> PermissionContext
fn clone(&self) -> PermissionContext
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 moreAuto Trait Implementations§
impl Freeze for PermissionContext
impl RefUnwindSafe for PermissionContext
impl Send for PermissionContext
impl Sync for PermissionContext
impl Unpin for PermissionContext
impl UnwindSafe for PermissionContext
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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