Skip to main content

Permissions

Struct Permissions 

Source
pub struct Permissions { /* private fields */ }
Expand description

What one person can do: the answers of their roles, brought together.

Implementations§

Source§

impl Permissions

Source

pub fn new( identity: Identity, entities: Vec<EntityInfo>, merge: RoleMerge, ) -> Self

What this person can do over these entities.

Source

pub fn identity(&self) -> &Identity

Who this is about.

Source

pub fn environment(&self) -> &Environment

What expressions about this person are evaluated with.

Source

pub fn is_administrator(&self) -> bool

Whether they can do everything.

Source

pub fn can_edit_model(&self) -> bool

Whether they can change the application’s model while it runs.

Source

pub fn can( &self, operation: Operation, entity: &str, record: Option<&Object>, ) -> bool

Whether they can do this to this record or, with none, to some record of the entity.

Source

pub fn can_field( &self, operation: Operation, entity: &str, field: &str, record: Option<&Object>, ) -> bool

Whether they can read or write this field of this record or, with none, of some record.

Source

pub fn can_navigate(&self, group: Option<&str>, item: &str) -> bool

Whether this navigation item shows, inside this group, if it has one. An item comes before its group, and what no role mentions shows.

Source

pub fn can_use_action(&self, action: &str) -> bool

Whether this action exists for them. Any role that denies it takes it away.

Trait Implementations§

Source§

impl Debug for Permissions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.