MDL-61808 tool_monitor: Implemented privacy classes.
This plugin is now compatible with the new privacy system.
This commit is contained in:
@@ -51,14 +51,15 @@ class rule {
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the current user manage this rule?
|
||||
* Can the user manage this rule? Defaults to $USER.
|
||||
*
|
||||
* @param int $userid Check against this userid.
|
||||
* @return bool true if the current user can manage this rule, else false.
|
||||
*/
|
||||
public function can_manage_rule() {
|
||||
public function can_manage_rule($userid = null) {
|
||||
$courseid = $this->courseid;
|
||||
$context = empty($courseid) ? \context_system::instance() : \context_course::instance($this->courseid);
|
||||
return has_capability('tool/monitor:managerules', $context);
|
||||
return has_capability('tool/monitor:managerules', $context, $userid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user