From 4205983fad2e2f0a2501f4db6e24446a7b40f565 Mon Sep 17 00:00:00 2001 From: Jerome Mouneyrac Date: Tue, 14 May 2013 15:40:16 +0800 Subject: [PATCH] MDL-31209 web service error message: Indication about the service not containg the web service function is confusing --- webservice/lib.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/webservice/lib.php b/webservice/lib.php index 005787d1444..8e1898f9327 100644 --- a/webservice/lib.php +++ b/webservice/lib.php @@ -1633,10 +1633,17 @@ abstract class webservice_base_server extends webservice_server { if (!$allowed) { throw new webservice_access_exception( 'Access to the function '.$this->functionname.'() 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.'); + There could be multiple reasons for this: + 1. The service linked to the user token does not contain the function. + 2. The service is user-restricted and the user is not listed. + 3. The service is IP-restricted and the user IP is not listed. + 4. The service is time-restricted and the time has expired. + 5. The token is time-restricted and the time has expired. + 6. The service requires a specific capability which the user does not have. + 7. The function is called with username/password (no user token is sent) + and none of the services has the function to allow the user. + These settings can be found in Administration > Site administration + > Plugins > Web services > External services and Manage tokens.'); } // we have all we need now