Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-74202

The name of the disallowed protocol is not included in WS exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.11.7
    • 3.11.6
    • Web Services
    • MOODLE_311_STABLE
    • MOODLE_311_STABLE
    • Hide
      1. Log in as admin
      2. Create a new user
      3. Navigate to General > Advanced features in site administration
      4. Tick Enable web services and save changes
      5. Navigate to Server > Web services > External services in site administration
      6. Edit and enable Moodle mobile web service
      7. Navigate to Server > Web services > Manage protocols in site administration
      8. Enable REST protocol
      9. Navigate to Server > Web services > Manage tokens in site administration
      10. Create token for test user
      11. Execute the following in a terminal:

        $ curl --silent "<WWWROOT>/webservice/rest/server.php?moodlewsrestformat=json" --data "wsfunction=core_webservice_get_site_info&wstoken=<TOKEN>" | python -m json.tool
        

      12. Confirm you see the following in the response data:

        You are not allowed to use the rest protocol (missing capability: webservice/rest:use)
        

      Show
      Log in as admin Create a new user Navigate to General > Advanced features in site administration Tick Enable web services and save changes Navigate to Server > Web services > External services in site administration Edit and enable Moodle mobile web service Navigate to Server > Web services > Manage protocols in site administration Enable REST protocol Navigate to Server > Web services > Manage tokens in site administration Create token for test user Execute the following in a terminal: $ curl --silent "<WWWROOT>/webservice/rest/server.php?moodlewsrestformat=json" --data "wsfunction=core_webservice_get_site_info&wstoken=<TOKEN>" | python -m json.tool Confirm you see the following in the response data: You are not allowed to use the rest protocol (missing capability: webservice/rest:use)

      The exception thrown when user cannot use the given protocol contains the literal {$a} placeholder that was copied verbatim from the lang string when it was last updated in MDL-33060 (commit), rather than actual content

      Original lang string: https://github.com/moodle/moodle/commit/96d3b93ba3ea16b26166b23ef057745726fcbde9#diff-70d03993cea23d9da563d661f4658599a99033c7fa3e8790a8c3d86896cc6dffL139

      $ curl --silent "http://localhost:8000/webservice/rest/server.php?moodlewsrestformat=json" --data "wsfunction=core_webservice_get_site_info&wstoken=a00eec09d785a5064b3aaa7c98db4e76" | python -m json.tool
      {
          "debuginfo": "You are not allowed to use the {$a} protocol (missing capability: webservice/rest:use)",
          "errorcode": "accessexception",
          "exception": "webservice_access_exception",
          "message": "Access control exception (You are not allowed to use the {$a} protocol (missing capability: webservice/rest:use))"
      }
      

      Replace {$a} with the actual string content, to ensure the thrown exception makes sense

            pholden Paul Holden
            pholden Paul Holden
            David Carrillo David Carrillo
            Andrew Lyons Andrew Lyons
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 40 minutes
                40m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.