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

New Web Service mod_wiki_get_subwikis

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Test wiki 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 2 wiki activities without groups: a collaborative and an individual. Don't create any page yet.
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the student user and another one for the teacher 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. We'll test the collaborative wiki first.
        • You need to replace the wstoken, wikiid (the wiki instance value) and the URL of your moodle instance.

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

      7. Confirm that you receive a list with only 1 subwiki. Confirm that groupid and userid are both set to 0 (collaborative wikis with no groups only have 1 subwiki). Confirm that canedit is set to true. Confirm that subwiki's id is set to -1 since it doesn't exist yet.
      8. Create a page in the collaborative wiki.
      9. Perform the request again and check that now the subwiki's ID is no longer -1.
      10. Now we'll test the individual wiki. Perform the request again but using the wikiid of the individual wiki.
      11. Confirm that you receive a list with only 1 subwiki. Confirm that groupid is set to 0 (no groups) and userid is equal to the ID of the student. Confirm that canedit is set to true.
      Test wiki with visible groups
      1. Create 2 new wikis but using visible groups: one individual and one collaborative.
      2. We'll test the collaborative wiki first. Perform the request again but using the wikiid of the collaborative wiki with visible groups.
      3. Confirm that you receive 3 subwikis: 1 per group + 1 with groupid set to 0 (all participants). Confirm that userid is set to 0 in all subwikis. Confirm that canedit is set to true in the subwiki of the group he belongs to, and set to false in the rest.
      4. Now perform the request again but using the wikiid of the individual wiki with visible groups.
      5. Confirm that you receive 2 subwikis: a subwiki with userid set to the student's ID and groupid set to the student's group, and another one with userid set to teacher's ID and groupid set to 0. Confirm that canedit is set to true in the student's subwiki and set to false in the other one.
      6. Now we'll test the collaborative wiki as a teacher. Perform the request again using the collaborative wikiid and the teacher's token.
      7. Confirm that you receive 3 subwikis: 1 per group + 1 with groupid set to 0 (all participants). Confirm that userid is set to 0 in all subwikis. Confirm that canedit is set to true in all the subwikis.
      Test wiki with separate groups
      1. Now create 2 new wikis but using separate groups: one individual and one collaborative.
      2. We'll test the collaborative wiki first. Perform the request again but using the wikiid of the collaborative wiki with separate groups.
      3. Confirm that you receive 1 subwiki with userid set to 0 and groupid set to the student's group. Confirm that canedit is set to true.
      4. Now perform the request again but using the wikiid of the individual wiki with separate groups.
      5. Confirm that you receive only 1 subwiki. Confirm that userid is set to the student ID and groupid is the group he belongs to. Confirm that canedit is set to true.
      6. Now we'll test the individual wiki as a teacher. Perform the request again using the individual wikiid and the teacher's token.
      7. Confirm that you receive 2 subwikis: a subwiki with userid set to the student's ID and groupid set to the student's group, and another one with userid set to teacher's ID and groupid set to 0. Confirm that canedit is set to true in all the subwikis.
      Show
      Test wiki 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 2 wiki activities without groups: a collaborative and an individual. Don't create any page yet. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user and another one for the teacher 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. We'll test the collaborative wiki first. You need to replace the wstoken, wikiid (the wiki instance value) and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwikis&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that you receive a list with only 1 subwiki. Confirm that groupid and userid are both set to 0 (collaborative wikis with no groups only have 1 subwiki). Confirm that canedit is set to true. Confirm that subwiki's id is set to -1 since it doesn't exist yet. Create a page in the collaborative wiki. Perform the request again and check that now the subwiki's ID is no longer -1. Now we'll test the individual wiki. Perform the request again but using the wikiid of the individual wiki. Confirm that you receive a list with only 1 subwiki. Confirm that groupid is set to 0 (no groups) and userid is equal to the ID of the student. Confirm that canedit is set to true. Test wiki with visible groups Create 2 new wikis but using visible groups: one individual and one collaborative. We'll test the collaborative wiki first. Perform the request again but using the wikiid of the collaborative wiki with visible groups. Confirm that you receive 3 subwikis: 1 per group + 1 with groupid set to 0 (all participants). Confirm that userid is set to 0 in all subwikis. Confirm that canedit is set to true in the subwiki of the group he belongs to, and set to false in the rest. Now perform the request again but using the wikiid of the individual wiki with visible groups. Confirm that you receive 2 subwikis: a subwiki with userid set to the student's ID and groupid set to the student's group, and another one with userid set to teacher's ID and groupid set to 0. Confirm that canedit is set to true in the student's subwiki and set to false in the other one. Now we'll test the collaborative wiki as a teacher. Perform the request again using the collaborative wikiid and the teacher's token. Confirm that you receive 3 subwikis: 1 per group + 1 with groupid set to 0 (all participants). Confirm that userid is set to 0 in all subwikis. Confirm that canedit is set to true in all the subwikis. Test wiki with separate groups Now create 2 new wikis but using separate groups: one individual and one collaborative. We'll test the collaborative wiki first. Perform the request again but using the wikiid of the collaborative wiki with separate groups. Confirm that you receive 1 subwiki with userid set to 0 and groupid set to the student's group. Confirm that canedit is set to true. Now perform the request again but using the wikiid of the individual wiki with separate groups. Confirm that you receive only 1 subwiki. Confirm that userid is set to the student ID and groupid is the group he belongs to. Confirm that canedit is set to true. Now we'll test the individual wiki as a teacher. Perform the request again using the individual wikiid and the teacher's token. Confirm that you receive 2 subwikis: a subwiki with userid set to the student's ID and groupid set to the student's group, and another one with userid set to teacher's ID and groupid set to 0. Confirm that canedit is set to true in all the subwikis.
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-52809-master

      Description

      This WebService will return the list of subwikis a user can view in a certain wiki. It will return all the possible subwikis, not only the ones created in database.

      This WS is similar to the creation of the dropdown in Moodle web to pick which subwiki you want to edit.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dpalou Dani Palou
                Reporter:
                dpalou Dani Palou
                Peer reviewer:
                Jun Pataleta
                Integrator:
                Dan Poltawski
                Tester:
                Simey Lameze
                Participants:
                Component watchers:
                Juan Leyva, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

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