pub fn impersonate_button<'a>(cx: &'a Cx, target: &dyn PanelUser) -> BoxView<'a>Expand description
A button that acts as target, for a page of the app’s own, such as a staff list over a user
type that is no model, where the Impersonate action cannot go: a form
that posts target’s user_id to {prefix}/impersonate with the CSRF
field.
It renders nothing unless the signed-in user may act as target under the panel’s
Impersonation rule, as the action’s button shows only then; the route asks the rule again.
fn act_as<'a>(cx: &'a Cx, colleague: &dyn PanelUser) -> impl View + 'a {
let button = auth::impersonate_button(cx, colleague);
view! { <td>(button)</td> }
}