Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29934 Web service API Roadmap
  3. MDL-46458

mod_forum_get_forum_discussions_paginated

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.8
    • Component/s: Forum, Web Services
    • Labels:
    • Testing Instructions:
      Hide

      First of all, remember to upgrade your Moodle site, the forum and moodle version numbers are bumped.

      1. Enable "Mobile services": Plugins ► Web Services ► External services
      2. You need two tokens (two different users) for the Mobile Service, for creating a Token:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
        • Click add, select user and service (Mobile Service)
      1. Create a new course with separate groups, create two different groups (g1 and g2) in the course and assign a different user in each one (the users you used for the tokens, user1 to g1 and user2 to g2)
      2. Create a new forum with three discussions:
      • One discussion created by user1
      • Another one created by user2
      • Another created for a teacher or a different user in the group (not assigned to any group)
        Ensure in Moodle that user1 see their own discussion and the discussion created by the teacher, same for user2
      1. Edit the curl command (see bellow) for adding your custom token for user1 and Moodle URL, also the forum id
      2. Run the command
      3. Check that you receive only the discussions the user should see
      4. Edit the curl command for adding the token for user2, check that this user only see these discussion and the teacher one
      5. Change course and forum group visibility (ensure that in Moodle user1 can see all the discussions now)
      6. Run again the command, you should see all the forum discussions
      • Note, you can use jsonlint.com to validate and format the json returned string

      curl 'http://localhost/moodlebugs/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'forumid=8&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed
      

      Show
      First of all, remember to upgrade your Moodle site, the forum and moodle version numbers are bumped. Enable "Mobile services": Plugins ► Web Services ► External services You need two tokens (two different users) for the Mobile Service, for creating a Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Create a new course with separate groups, create two different groups (g1 and g2) in the course and assign a different user in each one (the users you used for the tokens, user1 to g1 and user2 to g2) Create a new forum with three discussions: One discussion created by user1 Another one created by user2 Another created for a teacher or a different user in the group (not assigned to any group) Ensure in Moodle that user1 see their own discussion and the discussion created by the teacher, same for user2 Edit the curl command (see bellow) for adding your custom token for user1 and Moodle URL, also the forum id Run the command Check that you receive only the discussions the user should see Edit the curl command for adding the token for user2, check that this user only see these discussion and the teacher one Change course and forum group visibility (ensure that in Moodle user1 can see all the discussions now) Run again the command, you should see all the forum discussions Note, you can use jsonlint.com to validate and format the json returned string curl 'http://localhost/moodlebugs/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'forumid=8&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-46458-master

      Description

      This is related to MDL-45303

      The forum Moodle uses page/perpage for pagination instead limitfrom/limitnum, the limitfrom and limitnum parameters of the mod_forum_get_forum_discussions external function should be changed to page and perpage parameters to match to the get_discussions API function

      This will allow us to use that API function and replace the current nasty/messy code

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Dan Poltawski
                Integrator:
                Damyon Wiese
                Tester:
                Jetha Chan
                Participants:
                Component watchers:
                Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Jake Dallimore, Jun Pataleta
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14