mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
accesslib: is_siteadmin() bugfixes
Fixed two horrid bugs in is_siteadmin(). Both userid and the check for matching cpabilities lines were wrong.
This commit is contained in:
parent
9f560a0ccb
commit
987e7eb19a
1 changed files with 2 additions and 2 deletions
|
@ -425,9 +425,9 @@ function is_siteadmin($userid) {
|
||||||
ON (ra.roleid=rc.roleid AND rc.contextid=ctx.id)
|
ON (ra.roleid=rc.roleid AND rc.contextid=ctx.id)
|
||||||
WHERE ctx.contextlevel=10
|
WHERE ctx.contextlevel=10
|
||||||
AND rc.capability IN ('moodle/site:config', 'moodle/legacy:admin', 'moodle/site:doanything')
|
AND rc.capability IN ('moodle/site:config', 'moodle/legacy:admin', 'moodle/site:doanything')
|
||||||
AND u.id={$USER->id}";
|
AND u.id={$userid}";
|
||||||
|
|
||||||
$isadmin = (get_field_sql($sql) == 0);
|
$isadmin = (get_field_sql($sql) > 0);
|
||||||
return $isadmin;
|
return $isadmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue