pub trait HasSession {
// Required method
fn session(&self) -> Option<&Session>;
// Provided methods
fn allowed_to<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P,
) -> bool { ... }
fn check_permission<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P,
) -> Result<(), Error> { ... }
}Expand description
Functions to access information about the current session (authentication).
Required Methods§
Provided Methods§
Sourcefn allowed_to<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P,
) -> bool
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.
Sourcefn check_permission<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P,
) -> Result<(), Error>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.