Skip to main content

Module authorization

Module authorization 

Source
Expand description

Actix plumbing around the authorization policy engine in headless_lms_authorization.

Structs§

ActionOnResource
AuthorizationError
Error type used by the authorization checks.
AuthorizationToken
Proof that an authorization check passed.
AuthorizedResponse
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.
AuthorizationErrorType
The type of AuthorizationError that occured.
Resource
The target of an action.

Traits§

AuthorizedOk
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 action on resource, 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_roles allow action on resource.
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.