Skip to main content

can

Function can 

Source
pub fn can<R: Resource>(cx: &Cx, ability: Ability<'_, R::Model>) -> bool
Expand description

Whether the request may do ability on R as the context’s panel mounted it: what the ability’s button and route ask. false when the panel does not mount R. Does not check sign-in or tenant scope.

It is the policy’s answer and what the ability rests on: Run also takes a record the action’s can_run admits, and a force delete the delete it implies. RunHeader is the policy’s answer alone: a header action’s can_run may be what asks it. While someone acts as another user under an Impersonation that is not writable, only the reads are allowed.