mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-41413 Events: replaced role_assigned event handler with observer
This commit is contained in:
parent
ed204cb514
commit
f58915f0bb
3 changed files with 33 additions and 36 deletions
|
@ -234,35 +234,6 @@ class enrol_meta_handler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered via role assigned event.
|
||||
* @static
|
||||
* @param stdClass $ra
|
||||
* @return bool success
|
||||
*/
|
||||
public static function role_assigned($ra) {
|
||||
if (!enrol_is_enabled('meta')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// prevent circular dependencies - we can not sync meta roles recursively
|
||||
if ($ra->component === 'enrol_meta') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// only course level roles are interesting
|
||||
if (!$parentcontext = context::instance_by_id($ra->contextid, IGNORE_MISSING)) {
|
||||
return true;
|
||||
}
|
||||
if ($parentcontext->contextlevel != CONTEXT_COURSE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
self::sync_course_instances($parentcontext->instanceid, $ra->userid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered via role unassigned event.
|
||||
* @static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue