pub struct AccessContext {
pub subject_id: Option<String>,
pub tenant_id: Option<String>,
pub roles: BTreeSet<String>,
pub scopes: BTreeSet<String>,
/* private fields */
}Expand description
The subject being checked against an access policy.
Fields§
§subject_id: Option<String>Authenticated user or service principal ID.
tenant_id: Option<String>Tenant carried with the subject, if any.
roles: BTreeSet<String>Subject roles.
scopes: BTreeSet<String>Subject scopes or permissions.
Implementations§
Source§impl AccessContext
impl AccessContext
Sourcepub fn super_admin(_token: SuperAdminToken) -> Self
pub fn super_admin(_token: SuperAdminToken) -> Self
Super-admin context. The token cannot be fabricated outside qail-core.
Sourcepub fn with_tenant(self, tenant_id: impl Into<String>) -> Self
pub fn with_tenant(self, tenant_id: impl Into<String>) -> Self
Attach a tenant ID.
Sourcepub fn with_roles<I, S>(self, roles: I) -> Self
pub fn with_roles<I, S>(self, roles: I) -> Self
Attach many roles.
Sourcepub fn with_scope(self, scope: impl Into<String>) -> Self
pub fn with_scope(self, scope: impl Into<String>) -> Self
Attach one scope.
Sourcepub fn with_scopes<I, S>(self, scopes: I) -> Self
pub fn with_scopes<I, S>(self, scopes: I) -> Self
Attach many scopes.
Sourcepub fn bypasses_access(&self) -> bool
pub fn bypasses_access(&self) -> bool
Returns true when this context bypasses vertical checks.
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 (const: unstable) · 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 AccessContext
impl Debug for AccessContext
Source§impl Default for AccessContext
impl Default for AccessContext
impl Eq for AccessContext
Source§impl PartialEq for AccessContext
impl PartialEq for AccessContext
Source§fn eq(&self, other: &AccessContext) -> bool
fn eq(&self, other: &AccessContext) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AccessContext
Auto Trait Implementations§
impl Freeze for AccessContext
impl RefUnwindSafe for AccessContext
impl Send for AccessContext
impl Sync for AccessContext
impl Unpin for AccessContext
impl UnsafeUnpin for AccessContext
impl UnwindSafe for AccessContext
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