pub struct Impersonate;Expand description
Acts as the record’s user: an Action for a resource whose model is the panel’s user type,
placed on its rows and record pages.
Its button shows only on a user the signed-in user may act as under the panel’s
Impersonation rule, and never while they act as someone already.
Running it lands on the panel root as that user. The resource’s policy must also allow
Ability::Run on the record.
struct Users;
impl Resource for Users {
type Model = AdminUser;
type Form = NoForm<AdminUser>;
fn declare() -> ResourceDef<Self> {
ResourceDef::new().policy(Allow).action::<Impersonate>()
}
}Trait Implementations§
Source§impl<R> Action<R> for Impersonate
impl<R> Action<R> for Impersonate
Source§const NAME: &'static str = "impersonate"
const NAME: &'static str = "impersonate"
The action’s URL segment, distinct among the resource’s actions. Read more
Source§type Input = ()
type Input = ()
What the action asks for before it runs:
() for nothing, or an
FormInput struct, such as a rejection’s reason.Source§fn declare() -> ActionDef<R>
fn declare() -> ActionDef<R>
Where the action’s button renders, how it reads on each record, and which records it runs
on. Defaults to
ActionDef::new: a gray button on each row, page header and the bulk
bar, labelled after NAME, running without confirmation on every record the
policy allows. Read moreSource§async fn run(
cx: &Cx,
records: &[<R as Resource>::Model],
__arg2: (),
ex: &mut dyn Executor,
) -> Result<Outcome, WriteError<()>>
async fn run( cx: &Cx, records: &[<R as Resource>::Model], __arg2: (), ex: &mut dyn Executor, ) -> Result<Outcome, WriteError<()>>
Perform the action on
records, the records of the row or selection that
passed Ability::Run and ActionDef::can_run, with the parsed input, through
the framework’s transaction ex, and say what the response does once it commits:
Outcome::done for the ActionDef::success notification,
landing back where the action ran from. filter_keys writes one
change to every record in one statement. Read moreSource§fn validate_input(_cx: &Cx, _input: &Self::Input) -> FieldErrors<Self::Input>
fn validate_input(_cx: &Cx, _input: &Self::Input) -> FieldErrors<Self::Input>
Source§impl Clone for Impersonate
impl Clone for Impersonate
Source§fn clone(&self) -> Impersonate
fn clone(&self) -> Impersonate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Impersonate
Auto Trait Implementations§
impl Freeze for Impersonate
impl RefUnwindSafe for Impersonate
impl Send for Impersonate
impl Sync for Impersonate
impl Unpin for Impersonate
impl UnsafeUnpin for Impersonate
impl UnwindSafe for Impersonate
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