mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
MDL-28126 webservices : should not able to create token if user is deleted,unconfirmed,suspended or guest.
This commit is contained in:
parent
f89a83b87b
commit
94b9dad79d
3 changed files with 11 additions and 2 deletions
|
@ -179,7 +179,7 @@ class external_service_functions_form extends moodleform {
|
|||
class web_service_token_form extends moodleform {
|
||||
|
||||
function definition() {
|
||||
global $USER, $DB;
|
||||
global $USER, $DB, $CFG;
|
||||
|
||||
$mform = $this->_form;
|
||||
$data = $this->_customdata;
|
||||
|
@ -188,10 +188,12 @@ class web_service_token_form extends moodleform {
|
|||
|
||||
if (empty($data->nouserselection)) {
|
||||
//user searchable selector - get all users (admin and guest included)
|
||||
//user must be confirmed, not deleted, not suspended, not guest
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname
|
||||
FROM {user} u
|
||||
WHERE u.deleted = 0 AND u.confirmed = 1 AND u.suspended = 0 AND u.id != ?
|
||||
ORDER BY u.lastname";
|
||||
$users = $DB->get_records_sql($sql, array());
|
||||
$users = $DB->get_records_sql($sql, array($CFG->siteguest));
|
||||
$options = array();
|
||||
foreach ($users as $userid => $user) {
|
||||
$options[$userid] = $user->firstname . " " . $user->lastname;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue