Struct lightspeed_core::service::auth::AuthContext
source · pub struct AuthContext<'a, Id: IdType + MaybeWeb> {
pub auth: Auth<Id>,
/* private fields */
}
Fields§
§auth: Auth<Id>
Implementations§
source§impl<'a, Id: IdType + MaybeWeb> AuthContext<'a, Id>
impl<'a, Id: IdType + MaybeWeb> AuthContext<'a, Id>
pub fn is_authenticated(&self) -> Result<&AuthContext<'_, Id>, LsError>
pub fn has_role(&self, role: &str) -> Result<&AuthContext<'_, Id>, LsError>
pub fn has_any_role( &self, roles: &[&str] ) -> Result<&AuthContext<'_, Id>, LsError>
pub fn has_all_roles( &self, roles: &[&str] ) -> Result<&AuthContext<'_, Id>, LsError>
pub fn has_permission( &self, permission: &str ) -> Result<&AuthContext<'_, Id>, LsError>
pub fn has_any_permission( &self, permissions: &[&str] ) -> Result<&AuthContext<'_, Id>, LsError>
pub fn has_all_permissions( &self, permissions: &[&str] ) -> Result<&AuthContext<'_, Id>, LsError>
pub fn is_owner<T: Owned<Id>>( &self, obj: &T ) -> Result<&AuthContext<'_, Id>, LsError>
pub fn is_owner_or_has_role<T: Owned<Id>>( &self, obj: &T, role: &str ) -> Result<&AuthContext<'_, Id>, LsError>
pub fn is_owner_or_has_permission<T: Owned<Id>>( &self, obj: &T, permission: &str ) -> Result<&AuthContext<'_, Id>, LsError>
Auto Trait Implementations§
impl<'a, Id> Freeze for AuthContext<'a, Id>where
Id: Freeze,
impl<'a, Id> RefUnwindSafe for AuthContext<'a, Id>where
Id: RefUnwindSafe,
impl<'a, Id> Send for AuthContext<'a, Id>
impl<'a, Id> Sync for AuthContext<'a, Id>
impl<'a, Id> Unpin for AuthContext<'a, Id>
impl<'a, Id> UnwindSafe for AuthContext<'a, Id>where
Id: UnwindSafe,
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