web-services - Moodle 2.9.1 -- 任何网络服务功能都会给出 'access control exception'

标签 web-services rest moodle

遵循各种指南,我设法完成了以下工作:

  • 使用包含“core_user_create_users”函数的 REST API 设置外部服务,
  • 设置一个用户帐户并分配它允许使用我设置的 REST API 服务,
  • 为 Web 服务用户定义了一个角色,原型(prototype)“经过身份验证的用户”,“系统”的上下文,
  • 设置角色以允许“moodle/user:create”和
  • 为 Web 服务用户手动生成一个没有过期的 token 。

  • 现在,当我转到内置 Web 服务测试客户端时,选择在 REST API 上使用基于 token 的身份验证,选择“moodle_user_create_users”函数并输入 token 和详细信息,我得到以下信息:
    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>
    

    我错过了什么?

    最佳答案

    我也有同样的异常(exception)。然后我在管理仪表板中进行了此更改。
    站点管理 -> 移动应用程序 -> 移动设置 -> 为移动设备启用 Web 服务。
    打开这个。
    那就是我解决我的问题的人。

    关于web-services - Moodle 2.9.1 -- 任何网络服务功能都会给出 'access control exception',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31482243/

    相关文章:

    javascript - Ratchet Websockets - 检测断开连接的客户端

    java - REST 和 RESTful WS

    azure - 如何使用 Rest API 管理 Azure DevOps 组权限

    javascript - 如何从 REST 响应渲染对象

    rest - 新的API版本是否也应该支持旧版本的所有API? [设计问题]

    php - 从不同服务器上的php代码调用php代码

    mySQL 相当于 Oracle utl_http.request

    drupal - 将 Drupal + Moodle + MediaWiki 与 OpenID 集成

    moodle - 如何在moodle中为新用户分配教师角色?

    php - 获取 JSON 格式的 Moodle 数据