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

New Web Service mod_wiki_get_page_contents

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test without groups

      1. Create a course with a student and a teacher. The course must have at least one section.
      2. Create two groups in the course and add the student in one of them (not both).
      3. Create a collaborative wiki activity without groups. Add at least one page to that wiki.
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the student user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken, pageid and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_page_contents&pageid=1&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      7. Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to true and that groupid is 0 (no groups).

      Test with visible groups

      1. Now create a new collaborative wiki but using visible groups. Create at least 1 page per group.
      2. Perform the request again using the pageid of the group the student belongs to.
      3. Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to true and that groupid is the right one.
      4. Now perform another request but with the page belonging to the other group (the one the user doesn't belong to).
      5. Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to false and that groupid is the right one.

      Test with separate groups

      1. Now create a new wiki but using separate groups. Create at least 1 page per group.
      2. Perform a request to get the page of the group the user doesn't belong to.
      3. Confirm that you get an error of type 'cannotviewpage'.
      4. Now create a token for the teacher user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Now perform a request using the teacher token and a page of a group the teacher doesn't belong to.
      6. Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to true and that groupid is the right one.
      Show
      Test without groups Create a course with a student and a teacher. The course must have at least one section. Create two groups in the course and add the student in one of them (not both). Create a collaborative wiki activity without groups. Add at least one page to that wiki. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile 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, pageid and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_page_contents&pageid=1&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to true and that groupid is 0 (no groups). Test with visible groups Now create a new collaborative wiki but using visible groups. Create at least 1 page per group. Perform the request again using the pageid of the group the student belongs to . Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to true and that groupid is the right one. Now perform another request but with the page belonging to the other group (the one the user doesn't belong to). Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to false and that groupid is the right one. Test with separate groups Now create a new wiki but using separate groups. Create at least 1 page per group. Perform a request to get the page of the group the user doesn't belong to. Confirm that you get an error of type ' cannotviewpage '. Now create a token for the teacher user. Click on Site administration ► Plugins ► Web services ► Manage tokens Now perform a request using the teacher token and a page of a group the teacher doesn't belong to . Confirm that you receive the data of that page. Confirm that the page has the caneditpage attribute set to true and that groupid is the right one.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-51986-master

      Description

      This WS will return the contents of a wiki page.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16