Struct actionable::Permissions
source · [−]pub struct Permissions { /* private fields */ }
Expand description
A collection of allowed permissions. This is constructed from a
Vec<
Statement
>
. By default, no actions are allowed on any resources.
Implementations
sourceimpl Permissions
impl Permissions
sourcepub fn allow_all() -> Self
pub fn allow_all() -> Self
Returns a Permisions
instance constructed with
Statement::allow_all()
.
sourcepub fn check<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P
) -> Result<(), PermissionDenied>
pub fn check<'a, R: AsRef<[Identifier<'a>]>, P: Action>(
&self,
resource_name: R,
action: &P
) -> Result<(), PermissionDenied>
Evaluate whether the action
is allowed to be taken upon
resource_name
. Returns Ok
if permission is allowed.
Errors
Returns PermissionDenied
if permission is now allowed.
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
Evaluate whether the action
is allowed to be taken upon
resource_name
. Returns true if the action should be allowed. If no
statements that match resource_name
allow action
, false will be
returned.
sourcepub fn get<'a: 's, 's, R: AsRef<[Identifier<'a>]>>(
&'s self,
resource_name: R,
key: &str
) -> Option<&'s Configuration>
pub fn get<'a: 's, 's, R: AsRef<[Identifier<'a>]>>(
&'s self,
resource_name: R,
key: &str
) -> Option<&'s Configuration>
Looks up a configured value for resource_name
.
sourcepub fn merged<'a>(permissions: impl IntoIterator<Item = &'a Self>) -> Self
pub fn merged<'a>(permissions: impl IntoIterator<Item = &'a Self>) -> Self
Returns a new instance that merges all allowed actions from
permissions
.
Trait Implementations
sourceimpl Clone for Permissions
impl Clone for Permissions
sourcefn clone(&self) -> Permissions
fn clone(&self) -> Permissions
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Permissions
impl Debug for Permissions
sourceimpl Default for Permissions
impl Default for Permissions
sourcefn default() -> Permissions
fn default() -> Permissions
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for Permissions
impl<'de> Deserialize<'de> for Permissions
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
sourceimpl From<Statement> for Permissions
impl From<Statement> for Permissions
sourceimpl Serialize for Permissions
impl Serialize for Permissions
Auto Trait Implementations
impl RefUnwindSafe for Permissions
impl Send for Permissions
impl Sync for Permissions
impl Unpin for Permissions
impl UnwindSafe for Permissions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more