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

External function forum_get_discussions_paginated fails for users without the viewqandawithoutposting capability

XMLWordPrintable

    • MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MDL-50489-master
    • Hide
      1. Create a course with a enrolled teacher and student
      2. Create a "Q&A" forum
      3. As teacher, post there a message
      4. Create a Token for the student user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, forumid (the forum instance id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data --data 'forumid=13&sortby=timemodified&sortdirection=DESC&page=0&perpage=20&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true'

          Note: you can append | python -m "json.tool" to see the command output formatted

      6. Confirm that
        • You can see the original post details
      Show
      Create a course with a enrolled teacher and student Create a "Q&A" forum As teacher, post there a message Create a Token for the student user: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user . You need to replace the wstoken, forumid (the forum instance id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data --data 'forumid=13&sortby=timemodified&sortdirection=DESC&page=0&perpage=20&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true' Note: you can append | python -m "json.tool" to see the command output formatted Confirm that You can see the original post details

      The function returns errors:

      {exception: "invalid_response_exception", errorcode: "invalidresponse", message: "Invalid response value detected"}

      debuginfo: "discussions => Invalid response value detected: Error in response - Missing following required key in a single structure: userfullname"
      errorcode: "invalidresponse"
      exception: "invalid_response_exception"
      message: "Invalid response value detected

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dan Poltawski Dan Poltawski
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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