MDL-61808 tool_monitor: Implemented privacy classes.

This plugin is now compatible with the new privacy system.
This commit is contained in:
Adrian Greeve
2018-04-14 10:42:23 +08:00
parent 20bf0c45ff
commit 25c8fd74ac
4 changed files with 526 additions and 3 deletions
+4 -3
View File
@@ -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);
}
/**