mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
merged fixed a bug where admin can't unassign himself from non-admin role in site context
This commit is contained in:
parent
a08d5db719
commit
30c82426e3
@ -155,9 +155,17 @@
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$topleveladmin = ( ($context->id == $sitecontext->id) &&
|
||||
has_capability('moodle/site:doanything', $sitecontext) );
|
||||
|
||||
$topleveladmin = false;
|
||||
|
||||
// we only worry about this if the role has doanything capability at site level
|
||||
if ($adminroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $sitecontext)) {
|
||||
foreach ($adminroles as $adminrole) {
|
||||
if ($adminrole->id == $roleid) {
|
||||
$topleveladmin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($frm->removeselect as $removeuser) {
|
||||
$removeuser = clean_param($removeuser, PARAM_INT);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user