Trait bonsaidb::core::connection::HasSession
pub trait HasSession {
// Required method
fn session(&self) -> Option<&Session>;
// Provided methods
fn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> bool
where R: AsRef<[Identifier<'a>]>,
P: Action { ... }
fn check_permission<'a, R, P>(
&self,
resource_name: R,
action: &P
) -> Result<(), Error>
where R: AsRef<[Identifier<'a>]>,
P: Action { ... }
}
Expand description
Functions to access information about the current session (authentication).
Required Methods§
Provided Methods§
fn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> boolwhere
R: AsRef<[Identifier<'a>]>,
P: Action,
fn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> boolwhere R: AsRef<[Identifier<'a>]>, P: Action,
Checks if action
is permitted against resource_name
.
fn check_permission<'a, R, P>(
&self,
resource_name: R,
action: &P
) -> Result<(), Error>where
R: AsRef<[Identifier<'a>]>,
P: Action,
fn check_permission<'a, R, P>( &self, resource_name: R, action: &P ) -> Result<(), Error>where R: AsRef<[Identifier<'a>]>, P: Action,
Checks if action
is permitted against resource_name
. If permission
is denied, returns a PermissionDenied
error.