Hi,
I am new to moodle and having some difficulties with web services in the latest version of Moodle 2.9.
I followed all the steps given in the documentation And using a token am getting a message 'Access control exception'.
Steps I followed:
1. Enable Web Services in advanced settings.
2. Created a user 'web-service'.
3. Created an external web service and added all functions.
4. Created web-service-role and allowed all the permissions.
5. Assign 'web-service-role' role to 'web-service' user.
6. Plugins > Manage Protocols > enabled REST protocol.
7. Created Token for web-service user.
8. Tested on Web service test client.
These same steps are working for version 2.8.
Can anyone help me with this??
Exact Exception:
URL: http://localhost/moodle/webservice/rest/server.php?wstoken=2b0e519d0f78baae211fc6f28c6dbbc0
<EXCEPTION class="webservice_access_exception">
<ERRORCODE>accessexception</ERRORCODE>
<MESSAGE>Access control exception</MESSAGE>
<DEBUGINFO>Access to the function moodle_user_create_users() is not allowed.
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.</DEBUGINFO>
</EXCEPTION>