MDL-41413 Events: replaced role_assigned event handler with observer

This commit is contained in:
Rajesh Taneja 2013-08-26 10:38:28 +08:00
parent ed204cb514
commit f58915f0bb
3 changed files with 33 additions and 36 deletions

View file

@ -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