MDL-26635 Return a more explicit debuginfo message when the user can not access the web service function

This commit is contained in:
Jerome Mouneyrac 2011-09-21 13:03:18 +08:00
parent 9cfaebbd0e
commit ccda013458
2 changed files with 2 additions and 1 deletions

View File

@ -26,6 +26,7 @@
$string['accessexception'] = 'Access control exception';
$string['accessnotallowed'] = 'Access to web service not allowed';
$string['actwebserviceshhdr'] = 'Active web service protocols';
$string['accesstofunctionnotallowed'] = 'Access to the function {$a}() is not allowed. Please check if a service containing the function is enabled. In the service settings: if the service is restricted check that the user is listed. Still in the service settings check for IP restriction or if the service requires a capability.';
$string['addaservice'] = 'Add service';
$string['addcapabilitytousers'] = 'Check users capability';
$string['addcapabilitytousersdescription'] = 'Users should have two capabilities - webservice:createtoken and a capability matching the protocols used, for example webservice/rest:use, webservice/soap:use. To achieve this, create a web services role with the appropriate capabilities allowed and assign it to the web services user as a system role.';

View File

@ -1310,7 +1310,7 @@ abstract class webservice_base_server extends webservice_server {
}
$rs->close();
if (!$allowed) {
throw new webservice_access_exception('Access to external function not allowed');
throw new webservice_access_exception(get_string('accesstofunctionnotallowed', 'webservice', $this->functionname));
}
// we have all we need now