pub async fn authorize_with_fetched_list_of_roles(
conn: &mut PgConnection,
action: Action,
_user_id: Option<Uuid>,
resource: Resource,
user_roles: &[Role]
) -> Result<AuthorizationToken, ControllerError>
Expand description
Same as authorize
, but takes as an argument Vec<Role>
so that we avoid fetching the roles from the database for optimization reasons. This is useful when we’re checking multiple authorizations at once.