Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0e79528
)
MDL-54035 accesslib: Check if the user can switch role before switching
author
David Monllao
<davidm@moodle.com>
Wed, 26 Sep 2018 11:03:08 +0000
(13:03 +0200)
committer
David Monllao
<davidm@moodle.com>
Wed, 26 Sep 2018 11:03:08 +0000
(13:03 +0200)
lib/accesslib.php
patch
|
blob
|
blame
|
history
diff --git
a/lib/accesslib.php
b/lib/accesslib.php
index
2ca9f4d
..
27ec530
100644
(file)
--- a/
lib/accesslib.php
+++ b/
lib/accesslib.php
@@
-1019,7
+1019,9
@@
function reload_all_capabilities() {
foreach ($sw as $path => $roleid) {
if ($record = $DB->get_record('context', array('path'=>$path))) {
$context = context::instance_by_id($record->id);
- role_switch($roleid, $context);
+ if (has_capability('moodle/role:switchroles', $context)) {
+ role_switch($roleid, $context);
+ }
}
}
}