diff --git a/lib/ajax/service.php b/lib/ajax/service.php index 366f1ad16ff..ce58f01d026 100644 --- a/lib/ajax/service.php +++ b/lib/ajax/service.php @@ -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');