mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
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:
parent
ba224fb42c
commit
ad348cbdf9
1 changed files with 5 additions and 0 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue