pub struct User {
pub username: String,
pub role: Role,
}Expand description
Authenticated user — username + assigned role. Held inside
Access::User when a request has been authenticated; the
Arc keeps Access cheap to clone across the pipeline.
Fields§
§username: StringThe user’s login name.
role: RoleThe user’s assigned role.
Implementations§
Source§impl User
impl User
Sourcepub fn super_user(username: String) -> Self
pub fn super_user(username: String) -> Self
Build a user with the built-in super_user role.
Sourcepub const fn is_super_user(&self) -> bool
pub const fn is_super_user(&self) -> bool
true if this user’s role has super_user = true.
Sourcepub fn can_read_table(&self, database: &str, table: &str) -> bool
pub fn can_read_table(&self, database: &str, table: &str) -> bool
May this user read records from database.table?
Sourcepub fn can_insert_table(&self, database: &str, table: &str) -> bool
pub fn can_insert_table(&self, database: &str, table: &str) -> bool
May this user insert records into database.table?
Sourcepub fn can_update_table(&self, database: &str, table: &str) -> bool
pub fn can_update_table(&self, database: &str, table: &str) -> bool
May this user update records in database.table?
Sourcepub fn can_delete_table(&self, database: &str, table: &str) -> bool
pub fn can_delete_table(&self, database: &str, table: &str) -> bool
May this user delete records from database.table?
Sourcepub fn can_read_attribute(
&self,
database: &str,
table: &str,
attr: &str,
) -> bool
pub fn can_read_attribute( &self, database: &str, table: &str, attr: &str, ) -> bool
May this user read field attr on database.table?
Sourcepub fn can_write_attribute(
&self,
database: &str,
table: &str,
attr: &str,
) -> bool
pub fn can_write_attribute( &self, database: &str, table: &str, attr: &str, ) -> bool
May this user write field attr on database.table?
Sourcepub fn has_unrestricted_attributes(&self, database: &str, table: &str) -> bool
pub fn has_unrestricted_attributes(&self, database: &str, table: &str) -> bool
true if no per-attribute restrictions apply for database.table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnsafeUnpin for User
impl UnwindSafe for User
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