MDL-50783 ajax: Add specific check for NO_MOODLE_COOKIES
If loginrequired is set for a webservice - NO_MOODLE_COOKIES cannot be true - or it is a coding error.
This commit is contained in:
@@ -58,6 +58,11 @@ foreach ($requests as $request) {
|
||||
|
||||
// Do not allow access to write or delete webservices as a public user.
|
||||
if ($externalfunctioninfo->loginrequired) {
|
||||
if (defined('NO_MOODLE_COOKIES') && NO_MOODLE_COOKIES) {
|
||||
error_log('Set "loginrequired" to false in db/service.php when calling entry point service-nologin.php. ' .
|
||||
'Failed to call "' . $methodname . '"');
|
||||
throw new moodle_exception('servicenotavailable', 'webservice');
|
||||
}
|
||||
if (!isloggedin()) {
|
||||
error_log('This external function is not available to public users. Failed to call "' . $methodname . '"');
|
||||
throw new moodle_exception('servicenotavailable', 'webservice');
|
||||
|
||||
Reference in New Issue
Block a user