+ if (!has_any_capability(['moodle/site:viewparticipants', 'moodle/course:enrolreview'], $systemcontext)) {
+ // We know they do not have any of the capabilities, so lets throw an exception using the capability with the least access.
+ throw new required_capability_exception($systemcontext, 'moodle/site:viewparticipants', 'nopermissions', '');
+ }