pub struct Account {
pub username: String,
pub email: String,
pub phone: String,
pub real_name: String,
pub admin: bool,
pub disabled: bool,
pub grants: Vec<String>,
pub networks: Vec<String>,
}Fields§
§username: String§email: String§phone: String§real_name: String§admin: bool§disabled: bool§grants: Vec<String>Named capabilities. Empty means an ordinary dashboard account; an administrator holds every grant implicitly and stores none.
networks: Vec<String>Networks a granted account may act on. Meaningful only alongside
grants, and never empty then.
Implementations§
Source§impl Account
impl Account
Sourcepub fn holds(&self, grant: &str) -> bool
pub fn holds(&self, grant: &str) -> bool
Whether this account may exercise grant.
An administrator answers true for everything without storing anything,
which is why this is a method rather than a contains at each call site.
Sourcepub fn may_use_network(&self, network: &str) -> bool
pub fn may_use_network(&self, network: &str) -> bool
Whether this account may act on network. An unscoped ordinary account
(no grants) is not restricted by scope; a granted one is.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Account
impl<'de> Deserialize<'de> for Account
Source§fn 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
Auto Trait Implementations§
impl Freeze for Account
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnsafeUnpin for Account
impl UnwindSafe for Account
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more