Struct bonsaidb_core::connection::Session
source · [−]pub struct Session {
pub id: Option<SessionId>,
pub identity: Option<Arc<Identity>>,
pub permissions: Permissions,
}Expand description
The authentication state for a StorageConnection.
Fields
id: Option<SessionId>The session’s unique ID.
identity: Option<Arc<Identity>>The authenticated identity, if any.
permissions: PermissionsThe effective permissions of the session.
Implementations
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
sourcefn 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
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more