mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-8840 Loginas cleanup, better course isolation; merged from MOODLE_18_STABLE
This commit is contained in:
parent
1976496e38
commit
c16ec80252
@ -1124,6 +1124,14 @@ function load_all_capabilities() {
|
||||
if ($USER->loginascontext->contextlevel != CONTEXT_SYSTEM) {
|
||||
// load only course caqpabilitites - it may not always work as expected
|
||||
load_user_capability('', $USER->loginascontext);
|
||||
// find all child contexts and unset the rest
|
||||
$children = get_child_contexts($USER->loginascontext);
|
||||
$children[] = $USER->loginascontext->id;
|
||||
foreach ($USER->capabilities as $conid => $caps) {
|
||||
if (!in_array($conid, $children)) {
|
||||
unset($USER->capabilities[$conid]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
load_user_capability();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user