pub struct RlsContext {
pub operator_id: String,
pub agent_id: String,
pub is_super_admin: bool,
}Fields§
§operator_id: StringThe operator (vendor) this context is scoped to. Empty string means no operator scope.
agent_id: StringThe agent (reseller) this context is scoped to. Empty string means no agent scope.
is_super_admin: boolWhen true, the current user is a platform super admin and should bypass tenant isolation.
Implementations§
Source§impl RlsContext
impl RlsContext
Sourcepub fn operator(operator_id: &str) -> RlsContext
pub fn operator(operator_id: &str) -> RlsContext
Create a context scoped to a specific operator.
Sourcepub fn agent(agent_id: &str) -> RlsContext
pub fn agent(agent_id: &str) -> RlsContext
Create a context scoped to a specific agent (reseller).
Sourcepub fn operator_and_agent(operator_id: &str, agent_id: &str) -> RlsContext
pub fn operator_and_agent(operator_id: &str, agent_id: &str) -> RlsContext
Create a context scoped to both operator and agent. Used when an agent is acting on behalf of an operator.
Sourcepub fn super_admin() -> RlsContext
pub fn super_admin() -> RlsContext
Create a super admin context that bypasses tenant isolation.
Sourcepub fn has_operator(&self) -> bool
pub fn has_operator(&self) -> bool
Returns true if this context has an operator scope.
Sourcepub fn bypasses_rls(&self) -> bool
pub fn bypasses_rls(&self) -> bool
Returns true if this context bypasses tenant isolation.
Trait Implementations§
Source§impl Clone for RlsContext
impl Clone for RlsContext
Source§fn clone(&self) -> RlsContext
fn clone(&self) -> RlsContext
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 RlsContext
impl Debug for RlsContext
Source§impl Display for RlsContext
impl Display for RlsContext
Source§impl PartialEq for RlsContext
impl PartialEq for RlsContext
impl Eq for RlsContext
impl StructuralPartialEq for RlsContext
Auto Trait Implementations§
impl Freeze for RlsContext
impl RefUnwindSafe for RlsContext
impl Send for RlsContext
impl Sync for RlsContext
impl Unpin for RlsContext
impl UnwindSafe for RlsContext
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.