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

New Web Service mod_wiki_get_subwiki_files

XMLWordPrintable

    • MOODLE_30_STABLE
    • MOODLE_31_STABLE
    • MDL-53703-master
    • Hide
      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 using separate groups. Create at least 1 page per group without any files embedded.
      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, wikiid (the wiki instance value), groupid and the URL of your moodle instance.

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

      7. Confirm that you receive an empty list of files.
      8. Now edit the page of the group the student belongs to (or add a new page in that subwiki) and embed at least 1 file in the contents (image, audio, video, ...).
      9. Perform the same request again and check that you receive the embedded files.
      10. Now perform another request but using the groupid the user doesn't belong to. Check that you receive an error of type 'cannotviewfiles'.
      11. Now create a token for the teacher user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      12. Now perform the request again using the teacher WS token and the groupid that has files.
      13. Confirm that you receive the list of files.
      Show
      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 using separate groups. Create at least 1 page per group without any files embedded . 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, wikiid (the wiki instance value), groupid and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_files&wikiid=4&groupid=4&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that you receive an empty list of files. Now edit the page of the group the student belongs to (or add a new page in that subwiki) and embed at least 1 file in the contents (image, audio, video, ...). Perform the same request again and check that you receive the embedded files. Now perform another request but using the groupid the user doesn't belong to. Check that you receive an error of type 'cannotviewfiles'. Now create a token for the teacher user. Click on Site administration ► Plugins ► Web services ► Manage tokens Now perform the request again using the teacher WS token and the groupid that has files. Confirm that you receive the list of files.

      This function will return the list of files in a subwiki, similar to what the option "Files" in Moodle web does.

            dpalou Dani Palou
            dpalou Dani Palou
            Juan Leyva Juan Leyva
            David Monllaó David Monllaó
            Andrew Lyons Andrew Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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