pub trait Authorizer<Actor, Action, Resource, AllowReason = (), ForbiddenReason = ()> {
// Required method
fn check(
actor: &Actor,
action: &Action,
resource: &Resource,
) -> AuthorizationDecision<AllowReason, ForbiddenReason>;
}Expand description
An authorization check.
§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).AllowReason: (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(
actor: &Actor,
action: &Action,
resource: &Resource,
) -> AuthorizationDecision<AllowReason, ForbiddenReason>
fn check( actor: &Actor, action: &Action, resource: &Resource, ) -> AuthorizationDecision<AllowReason, ForbiddenReason>
Perform the authorization check.
actor: Reference to who would perform the action on the resourceaction: Reference to what would be performed by the actor on the resourceresource: Reference to the target of the action performed by the actor
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.