Struct lockchain_core::users::User [−][src]
pub struct User { /* fields omitted */ }A generic user representation
A user has an identify check built in that can verify a passphrase but is ultimately only a metadata item for a API layer. Any layer is free to disregard these access rights (as such, they should not be considered security, only obscurity/ management control)
A company might not want allow non-admins to create new vaults or users to delete records. This does not cryptographically stop anyone from breaking into the company server, swapping the source code and changing the rules!
An user can have multiple role-access pairs
Methods
impl User[src]
impl Userpub fn register(name: &str, pw: &str) -> Self[src]
pub fn register(name: &str, pw: &str) -> SelfRegister a new user with a name and password
pub fn verify(&self, pw: &str) -> bool[src]
pub fn verify(&self, pw: &str) -> boolVerify a user password input
pub fn token(&mut self) -> String[src]
pub fn token(&mut self) -> StringGenerate a token unique to this user (or return the existing one)
pub fn has_access(&self, item: Access) -> Option<Role>[src]
pub fn has_access(&self, item: Access) -> Option<Role>Verify that a user is allowed access to a piece of data
None means "no access of any kind"
pub fn give_access(&mut self, item: Access, role: Role)[src]
pub fn give_access(&mut self, item: Access, role: Role)Modify access to an item for a role or create a new access entry
Trait Implementations
impl Clone for User[src]
impl Clone for Userfn clone(&self) -> User[src]
fn clone(&self) -> UserReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl AutoEncoder for User[src]
impl AutoEncoder for Userfn encode(&self) -> Result<String, SerdeError>[src]
fn encode(&self) -> Result<String, SerdeError>fn decode(s: &str) -> Result<Self, SerdeError>[src]
fn decode(s: &str) -> Result<Self, SerdeError>