mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 18:04:43 +02:00
Merge branch 'MDL-74147' of https://github.com/paulholden/moodle
This commit is contained in:
commit
d5c8f25470
admin/roles/classes
@ -38,24 +38,28 @@ class core_role_admins_existing_selector extends user_selector_base {
|
||||
$name = 'removeselect';
|
||||
}
|
||||
$options['multiselect'] = false;
|
||||
$options['includecustomfields'] = true;
|
||||
parent::__construct($name, $options);
|
||||
}
|
||||
|
||||
public function find_users($search) {
|
||||
global $DB, $CFG;
|
||||
list($wherecondition, $params) = $this->search_sql($search, '');
|
||||
|
||||
$fields = 'SELECT ' . $this->required_fields_sql('');
|
||||
[$wherecondition, $params] = $this->search_sql($search, 'u');
|
||||
$params = array_merge($params, $this->userfieldsparams);
|
||||
|
||||
$fields = 'SELECT u.id, ' . $this->userfieldsselects;
|
||||
|
||||
if ($wherecondition) {
|
||||
$wherecondition = "$wherecondition AND id IN ($CFG->siteadmins)";
|
||||
$wherecondition = "$wherecondition AND u.id IN ($CFG->siteadmins)";
|
||||
} else {
|
||||
$wherecondition = "id IN ($CFG->siteadmins)";
|
||||
$wherecondition = "u.id IN ($CFG->siteadmins)";
|
||||
}
|
||||
$sql = " FROM {user}
|
||||
$sql = " FROM {user} u
|
||||
$this->userfieldsjoin
|
||||
WHERE $wherecondition";
|
||||
|
||||
list($sort, $sortparams) = users_order_by_sql('', $search, $this->accesscontext);
|
||||
[$sort, $sortparams] = users_order_by_sql('u', $search, $this->accesscontext, $this->userfieldsmappings);
|
||||
$params = array_merge($params, $sortparams);
|
||||
|
||||
// Sort first by email domain and then by normal name order.
|
||||
|
@ -39,24 +39,28 @@ class core_role_admins_potential_selector extends user_selector_base {
|
||||
$name = 'addselect';
|
||||
}
|
||||
$options['multiselect'] = false;
|
||||
$options['includecustomfields'] = true;
|
||||
$options['exclude'] = explode(',', $CFG->siteadmins);
|
||||
parent::__construct($name, $options);
|
||||
}
|
||||
|
||||
public function find_users($search) {
|
||||
global $CFG, $DB;
|
||||
list($wherecondition, $params) = $this->search_sql($search, '');
|
||||
|
||||
$fields = 'SELECT ' . $this->required_fields_sql('');
|
||||
[$wherecondition, $params] = $this->search_sql($search, 'u');
|
||||
$params = array_merge($params, $this->userfieldsparams);
|
||||
|
||||
$fields = 'SELECT u.id, ' . $this->userfieldsselects;
|
||||
$countfields = 'SELECT COUNT(1)';
|
||||
|
||||
$sql = " FROM {user}
|
||||
$sql = " FROM {user} u
|
||||
$this->userfieldsjoin
|
||||
WHERE $wherecondition AND mnethostid = :localmnet";
|
||||
|
||||
// It could be dangerous to make remote users admins and also this could lead to other problems.
|
||||
$params['localmnet'] = $CFG->mnet_localhost_id;
|
||||
|
||||
list($sort, $sortparams) = users_order_by_sql('', $search, $this->accesscontext);
|
||||
[$sort, $sortparams] = users_order_by_sql('u', $search, $this->accesscontext, $this->userfieldsmappings);
|
||||
$order = ' ORDER BY ' . $sort;
|
||||
|
||||
// Check to see if there are too many to show sensibly.
|
||||
|
Loading…
x
Reference in New Issue
Block a user