pub struct ActingUser { /* private fields */ }Expand description
The signed-in user an action is done for: the panel builds it from the session on each
request and passes it to the resource’s queries and to its Policy. It holds the user’s
id, name and email, and the abilities their roles grant (such as books.update).
An app builds one itself only to call a resource or a policy outside the panel, such as in
a test, with new, with_ability and
with_super_admin.
Implementations§
Source§impl ActingUser
impl ActingUser
Sourcepub fn new(id: i64, name: impl Into<String>, email: impl Into<String>) -> Self
pub fn new(id: i64, name: impl Into<String>, email: impl Into<String>) -> Self
The user with id, name and email, with no abilities and no super-admin role.
Sourcepub fn with_ability(self, name: impl Into<String>) -> Self
pub fn with_ability(self, name: impl Into<String>) -> Self
Adds the ability name, such as books.update.
Sourcepub fn with_super_admin(self, super_admin: bool) -> Self
pub fn with_super_admin(self, super_admin: bool) -> Self
Sets whether the user holds the super-admin role.
Sourcepub fn is_super_admin(&self) -> bool
pub fn is_super_admin(&self) -> bool
Whether the user holds the super-admin role, which passes every ability check and
every policy, as Filament Shield’s super admin does.
Trait Implementations§
Source§impl Clone for ActingUser
impl Clone for ActingUser
Source§impl Debug for ActingUser
impl Debug for ActingUser
impl Eq for ActingUser
Source§impl PartialEq for ActingUser
impl PartialEq for ActingUser
impl StructuralPartialEq for ActingUser
Auto Trait Implementations§
impl Forget for ActingUser
impl Freeze for ActingUserwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, SetValZST> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, SetValZST)>>: Freeze,
impl Move for ActingUser
impl RefUnwindSafe for ActingUser
impl Send for ActingUser
impl Sync for ActingUser
impl Unpin for ActingUser
impl UnsafeUnpin for ActingUserwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, SetValZST> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, SetValZST)>>: UnsafeUnpin,
impl UnwindSafe for ActingUser
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more