pub trait AuthorizerWithContext<Actor, Action, Resource, Context, AllowReason = (), ForbiddenReason = ()> {
// Required method
fn check_with_context(
actor: &Actor,
action: &Action,
resource: &Resource,
context: &Context,
) -> AuthorizationDecision<AllowReason, ForbiddenReason>;
}Expand description
An authorization check with extra context.
§Type parameters
Actor: Type for who would perform the action (e.g.User).Action: Type for what would be performed (e.g.DeletePost).Resource: Type for the target of the action (e.g.Post).Context: Type for any additional data needed to make the decisionAllowReason: (Optional) Type of the allowed reason returned on anAlloweddecision. Defaults to().ForbiddenReason: (Optional) Type of forbidden reason returned on aForbiddendecision. Defaults to().
Required Methods§
Sourcefn check_with_context(
actor: &Actor,
action: &Action,
resource: &Resource,
context: &Context,
) -> AuthorizationDecision<AllowReason, ForbiddenReason>
fn check_with_context( actor: &Actor, action: &Action, resource: &Resource, context: &Context, ) -> AuthorizationDecision<AllowReason, ForbiddenReason>
Perform the authorization check given extra context.
actor: Reference to who would perform the action on the resourceaction: Reference to what would be performed by the actorresource: Reference to the target of the actioncontext: Reference to the extra data needed for this check
Returns an AuthorizationDecision that will be either allowed or forbidden and carrying
optional reason data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.