Skip to content

Commit

Permalink
MDL-29825 better debug info when a ws client user misses a protocol c…
Browse files Browse the repository at this point in the history
…apability
  • Loading branch information
mouneyrac committed Oct 21, 2011
1 parent 3a81b37 commit 729ca37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lang/en/webservice.php
Expand Up @@ -24,7 +24,6 @@
*/

$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';
Expand Down Expand Up @@ -130,6 +129,7 @@
$string['potusersmatching'] = 'Not authorised users matching';
$string['print'] = 'Print all';
$string['protocol'] = 'Protocol';
$string['protocolnotallowed'] = 'You are not allowed to use the {$a} protocol (missing capability: webservice/{$a}:use)';
$string['removefunction'] = 'Remove';
$string['removefunctionconfirm'] = 'Do you really want to remove function "{$a->function}" from service "{$a->service}"?';
$string['requireauthentication'] = 'This method requires authentication with xxx permission.';
Expand Down
2 changes: 1 addition & 1 deletion webservice/lib.php
Expand Up @@ -659,7 +659,7 @@ protected function authenticate_user() {
$this->userid = $user->id;

if ($this->authmethod != WEBSERVICE_AUTHMETHOD_SESSION_TOKEN && !has_capability("webservice/$this->wsname:use", $this->restricted_context)) {
throw new webservice_access_exception(get_string('accessnotallowed', 'webservice'));
throw new webservice_access_exception(get_string('protocolnotallowed', 'webservice', $this->wsname));
}

external_api::set_context_restriction($this->restricted_context);
Expand Down

0 comments on commit 729ca37

Please sign in to comment.