Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Used while evaluating conditions in bulk. More...
Public Member Functions | |
__construct (\context $context) | |
Constructs for given context. | |
get_users_by_capability ($capability) | |
Gets users on course who have the specified capability. | |
Protected Attributes | |
array | $cache = array() |
Associative array of capability => result. | |
context | $context |
Course or module context. | |
Used while evaluating conditions in bulk.
This object caches get_users_by_capability results in case they are needed by multiple conditions.
core_availability\capability_checker::__construct | ( | \context | $context | ) |
Constructs for given context.
context | $context | Context |
core_availability\capability_checker::get_users_by_capability | ( | $capability | ) |
Gets users on course who have the specified capability.
Returns an array of user objects which only contain the 'id' field. If the same capability has already been checked (e.g. by another condition) then a cached result will be used.
More fields are not necessary because this code is only used to filter users from an existing list.
string | $capability | Required capability |
array | Associative array of user id => objects containing only id |