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, P>(&self, resource_name: R, action: &P) -> bool
pub fn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> bool
Checks if action
is permitted against resource_name
.
sourcepub fn check_permission<'a, R, P>(
&self,
resource_name: R,
action: &P
) -> Result<(), Error>
pub fn check_permission<'a, R, P>( &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<Session, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Session, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Session
impl PartialEq for Session
source§impl Serialize for Session
impl Serialize for Session
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
§impl<T> CallHasher for T
impl<T> CallHasher for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.