mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-14978 removed obsoleted isadmin()
This commit is contained in:
parent
72f563b91c
commit
e3c7f155d8
23 changed files with 432 additions and 263 deletions
|
@ -35,38 +35,6 @@
|
|||
* @package moodlecore
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Determines if a user an admin
|
||||
*
|
||||
* @uses $USER
|
||||
* @param int $userid The id of the user as is found in the 'user' table
|
||||
* @staticvar array $admins List of users who have been found to be admins by user id
|
||||
* @staticvar array $nonadmins List of users who have been found not to be admins by user id
|
||||
* @return bool
|
||||
*/
|
||||
function isadmin($userid=0) {
|
||||
global $USER, $CFG;
|
||||
|
||||
if (empty($CFG->rolesactive)) { // Then the user is likely to be upgrading NOW
|
||||
if (!$userid) {
|
||||
if (empty($USER->id)) {
|
||||
return false;
|
||||
}
|
||||
if (!empty($USER->admin)) {
|
||||
return true;
|
||||
}
|
||||
$userid = $USER->id;
|
||||
}
|
||||
|
||||
return record_exists('user_admins', 'userid', $userid);
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
return has_capability('moodle/legacy:admin', $context, $userid, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a user is a teacher (or better)
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue