Struct bonsaidb_core::connection::Session
source · pub struct Session {
pub id: Option<SessionId>,
pub authentication: SessionAuthentication,
pub permissions: Permissions,
}
Expand description
The authentication state for a StorageConnection
.
Fields§
§id: Option<SessionId>
The session’s unique ID.
authentication: SessionAuthentication
The authenticated identity, if any.
permissions: Permissions
The effective permissions of the session.
Implementations§
source§impl Session
impl Session
sourcepub fn allowed_to<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P
) -> bool
pub fn allowed_to<'a, R: AsRef<[Identifier<'a>]>, P: Action>( &self, resource_name: R, action: &P ) -> bool
Checks if action
is permitted against resource_name
.
sourcepub fn check_permission<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P
) -> Result<(), Error>
pub fn check_permission<'a, R: AsRef<[Identifier<'a>]>, P: Action>( &self, resource_name: R, action: &P ) -> Result<(), Error>
Checks if action
is permitted against resource_name
. If permission
is denied, returns a PermissionDenied
error.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Session
impl PartialEq for Session
impl Eq for Session
Auto Trait Implementations§
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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