interacts_with_auth
Trait handling authentication and authorization logic for controllers.
Table of Contents
Properties
- $cm : mixed
- $course : mixed
- $request : Request
- $capabilities : array<string|int, mixed>
- $require_login : bool
- $require_sesskey : bool
- $required_login : bool
Methods
- set_require_capabilities() : void
- Define the capabilities that the user must have.
- set_require_login() : void
- Set if login is required and set related options.
- set_require_sesskey() : void
- Define the requirement of sesskey validation for non-idempotent requests.
- check_capabilities() : void
- Check if the user has the required capabilities.
- require_login() : void
- Ensure the user is logged in if required.
Properties
$cm
public
mixed
$cm
$course
public
mixed
$course
$request
public
Request
$request
$capabilities
protected
array<string|int, mixed>
$capabilities
= []
$require_login
protected
bool
$require_login
= false
$require_sesskey
protected
bool
$require_sesskey
= false
$required_login
protected
bool
$required_login
= false
Methods
set_require_capabilities()
Define the capabilities that the user must have.
public
set_require_capabilities(array<string|int, mixed> $capabilities) : void
Parameters
- $capabilities : array<string|int, mixed>
set_require_login()
Set if login is required and set related options.
public
set_require_login([mixed $course = null ][, mixed $cm = null ]) : void
Parameters
- $course : mixed = null
- $cm : mixed = null
set_require_sesskey()
Define the requirement of sesskey validation for non-idempotent requests.
public
set_require_sesskey([bool $require = true ]) : void
Parameters
- $require : bool = true
check_capabilities()
Check if the user has the required capabilities.
protected
check_capabilities() : void
Tags
require_login()
Ensure the user is logged in if required.
protected
require_login() : void