pub struct AccessContext {
pub user_id: String,
pub user_attributes: HashMap<String, String>,
pub resource_id: Option<String>,
pub resource_attributes: HashMap<String, String>,
pub ip_address: Option<String>,
pub timestamp: SystemTime,
pub metadata: HashMap<String, String>,
}
Expand description
Context information for access control decisions
Fields§
§user_id: String
User ID making the request
user_attributes: HashMap<String, String>
User attributes (department, level, etc.)
resource_id: Option<String>
Resource being accessed
resource_attributes: HashMap<String, String>
Resource attributes
ip_address: Option<String>
Request IP address
timestamp: SystemTime
Request timestamp
metadata: HashMap<String, String>
Additional context data
Implementations§
Source§impl AccessContext
impl AccessContext
Sourcepub fn with_user_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_user_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add user attribute
Sourcepub fn with_resource(self, resource_id: impl Into<String>) -> Self
pub fn with_resource(self, resource_id: impl Into<String>) -> Self
Set resource information
Sourcepub fn with_resource_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_resource_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add resource attribute
Sourcepub fn with_ip_address(self, ip: impl Into<String>) -> Self
pub fn with_ip_address(self, ip: impl Into<String>) -> Self
Set IP address
Trait Implementations§
Source§impl Clone for AccessContext
impl Clone for AccessContext
Source§fn clone(&self) -> AccessContext
fn clone(&self) -> AccessContext
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 AccessContext
impl RefUnwindSafe for AccessContext
impl Send for AccessContext
impl Sync for AccessContext
impl Unpin for AccessContext
impl UnwindSafe for AccessContext
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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