mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +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
|
@ -71,6 +71,12 @@ switch ($action) {
|
|||
}
|
||||
}
|
||||
|
||||
//check if the user is deleted. unconfirmed, suspended or guest
|
||||
$user = $DB->get_record('user', array('id' => $data->user));
|
||||
if ($user->id == $CFG->siteguest or $user->deleted or !$user->confirmed or $user->suspended) {
|
||||
throw new moodle_exception('forbiddenwsuser', 'webservice');
|
||||
}
|
||||
|
||||
//process the creation
|
||||
if (empty($errormsg)) {
|
||||
//TODO improvement: either move this function from externallib.php to webservice/lib.php
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue