Expand description
Actix plumbing around the authorization policy engine in headless_lms_authorization.
Structs§
- Action
OnResource - Authorization
Error - Error type used by the authorization checks.
- Authorization
Token - Proof that an authorization check passed.
- Authorized
Response - A controller’s response payload. Only AuthorizedOk::authorized_ok can build one, so answering a request requires having passed an authorization check.
Enums§
- Action
- Describes an action that a user can take on some resource.
- Authorization
Error Type - The type of AuthorizationError that occured.
- Resource
- The target of an action.
Traits§
- Authorized
Ok - Turns a token into a ControllerResult, which is the only way for a controller to build one. Lives here rather than on AuthorizationToken itself because the response type is tied to actix, which the policy engine deliberately does not depend on.
Functions§
- authorize
- Checks whether the user may perform
actiononresource, fetching their roles. - authorize_
access_ to_ chatbot - Handles authorization for global chatbots and course chatbots
- authorize_
access_ to_ course_ material - Checks whether the user may view course material.
- authorize_
with_ fetched_ list_ of_ roles - Same as authorize, but takes already-fetched roles instead of querying for them; use when checking several actions for the same user.
- can_
user_ view_ chapter - Checks whether the user may view a chapter, which may be closed to everyone but certain roles.
- is_
permitted - Whether
user_rolesallowactiononresource. - is_
user_ global_ admin - Whether the user holds a global admin role.
- skip_
authorize - Skips authorize(), for anonymous and test-user code paths where there is no user to check.