Permalink
Browse files

Merge branch 'MDL-63210_34' of git://github.com/markn86/moodle into M…

…OODLE_34_STABLE
  • Loading branch information...
dmonllao committed Aug 27, 2018
2 parents 3497dbd + 5b4811c commit dacd9f0aafd87bbcf779594b431187c3c5404f7f
Showing with 12 additions and 7 deletions.
  1. +1 −0 lang/en/webservice.php
  2. +1 −1 lib/amd/build/ajax.min.js
  3. +8 −4 lib/amd/src/ajax.js
  4. +2 −2 lib/externallib.php
@@ -186,6 +186,7 @@
$string['servicehelpexplanation'] = 'A service is a set of functions. A service can be accessed by all users or just specified users.';
$string['servicename'] = 'Service name';
$string['servicenotavailable'] = 'Web service is not available (it doesn\'t exist or might be disabled)';
$string['servicerequireslogin'] = 'Web service is not available (the session has been logged out or has expired)';
$string['servicesbuiltin'] = 'Built-in services';
$string['servicescustom'] = 'Custom services';
$string['serviceusers'] = 'Authorised users';

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -25,7 +25,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 2.9
*/
define(['jquery', 'core/config', 'core/log'], function($, config, Log) {
define(['jquery', 'core/config', 'core/log', 'core/url'], function($, config, Log, URL) {
// Keeps track of when the user leaves the page so we know not to show an error.
var unloading = false;
@@ -79,9 +79,13 @@ define(['jquery', 'core/config', 'core/log'], function($, config, Log) {
}
// Something failed, reject the remaining promises.
if (exception !== null) {
for (; i < requests.length; i++) {
request = requests[i];
request.deferred.reject(exception);
// Redirect to the login page.
if (exception.errorcode === "servicerequireslogin") {
window.location = URL.relativeUrl("/login/index.php");
} else {
requests.forEach(function(request) {
request.deferred.reject(exception);
});
}
}
};
@@ -208,10 +208,10 @@ public static function call_external_function($function, $args, $ajaxonly=false)
// Do not allow access to write or delete webservices as a public user.
if ($externalfunctioninfo->loginrequired) {
if (defined('NO_MOODLE_COOKIES') && NO_MOODLE_COOKIES && !PHPUNIT_TEST) {
throw new moodle_exception('servicenotavailable', 'webservice');
throw new moodle_exception('servicerequireslogin', 'webservice');
}
if (!isloggedin()) {
throw new moodle_exception('servicenotavailable', 'webservice');
throw new moodle_exception('servicerequireslogin', 'webservice');
} else {
require_sesskey();
}

0 comments on commit dacd9f0

Please sign in to comment.