Moodle 2.9.1 -- 任何网络服务功能都提供 'access control exception'

Moodle 2.9.1 -- Any web service function gives 'access control exception'

根据各种指南,我成功完成了以下任务:

现在,当我转到内置 Web 服务测试客户端时,select 在 REST API、select "moodle_user_create_users" 上使用基于令牌的身份验证] 函数并输入令牌和详细信息,我得到这个:

REST protocol: moodle_user_create_users
URL: [...]
'<?xml version="1.0" encoding="UTF-8" ?>
<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 &gt; Site administration
&gt; Plugins &gt; Web services &gt; External services and Manage tokens.</DEBUGINFO>
</EXCEPTION>

我错过了什么?

尝试从以下位置启用 Web 服务身份验证: 站点管理 > 插件 > 管理身份验证

我的回答好像和其他人的经历一样:Web Service Test Client 已经无可救药地坏掉了。

在我处理这个项目时这是一个已知问题,不幸的是 Moodle 决定继续发布这个功能。

在可预见的未来,我建议您不要浪费时间尝试使用这个 'tool'。

尝试获得令牌 https://yourmoodle/login/token.php?username=username&password=pass&service=webserviceshortname。 我来自 /admin/settings.php?section=webservicetokens 的令牌也不起作用 并在 /admin/settings.php?section=externalservices

中启用服务功能

我有同样的例外。然后我在管理仪表板中进行了此更改。

站点管理 -> 移动应用程序 -> 移动设置 -> 为移动设备启用 Web 服务。

打开它。

那是我解决问题的人。

在 Moodle 管理仪表板中配置所有元素(功能、用户、角色、操作角色、令牌)...

当我使用网络服务测试客户端时选择“core_user_create_users”函数,而不是“moodle_user_create_users”(我忽略了为什么后者是使用过),我没有出现异常,响应正常。