MDL-66034 core_role: implement capability assigned event

This commit is contained in:
Simey Lameze
2019-08-05 13:09:18 +08:00
parent 414eca8923
commit 7b0afca816
3 changed files with 112 additions and 0 deletions
+12
View File
@@ -1379,6 +1379,18 @@ function assign_capability($capability, $permission, $roleid, $contextid, $overw
}
}
// Trigger capability_assigned event.
\core\event\capability_assigned::create([
'userid' => $cap->modifierid,
'context' => $context,
'objectid' => $roleid,
'other' => [
'capability' => $capability,
'oldpermission' => $existing->permission ?? CAP_INHERIT,
'permission' => $permission
]
])->trigger();
// Reset any cache of this role, including MUC.
accesslib_clear_role_cache($roleid);