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

Return main file isexternalfile and repositorytype in core_course_get_course_contents

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.2
    • Fix Version/s: 3.7
    • Component/s: Resource, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Enable the "File system" repository in Moodle, see instructions here: https://docs.moodle.org/36/en/File_system_repository
      3. Add one file to the file system directory
      4. Create a course and enrol one user as student
      5. Inside the course create a "File" resource choosing from the "file resource" file picker a file from the "File system" repository
        1. Make sure to select "Create an alias / shortcut to the file" (Make a copy will not display as a filesystem file)
      6. Create a Token in the mobile app service for the student user from step 4
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. You will have to replace also the courseid to match the one in step 4 (please replace variables that are bold and underlined)

      curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=3&wsfunction=core_course_get_contents&wstoken=3af67232a7596ceb658df4db329e5ad6&options[0][name]=excludecontents&options[0][value]=true' --compressed | python -m "json.tool"

      1. Confirm that in the curl response:
        • The contentsinfo->repositorytype field for the resource you added is set to "filesystem"
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Enable the "File system" repository in Moodle, see instructions here: https://docs.moodle.org/36/en/File_system_repository Add one file to the file system directory Create a course and enrol one user as student Inside the course create a "File" resource choosing from the "file resource" file picker a file from the "File system" repository Make sure to select "Create an alias / shortcut to the file" (Make a copy will not display as a filesystem file) Create a Token in the mobile app service for the student user from step 4 Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. You will have to replace also the courseid to match the one in step 4 (please replace variables that are bold and underlined) curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid= 3 &wsfunction=core_course_get_contents&wstoken= 3af67232a7596ceb658df4db329e5ad6 &options [0] [name] =excludecontents&options [0] [value] =true' --compressed | python -m "json.tool" Confirm that in the curl response: The contentsinfo->repositorytype field for the resource you added is set to "filesystem"
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-65019-master

      Description

      In the app we need isexternalfile and repositorytype of the main file (first file) to be able to render the modules without retrieving the whole contents.

      This could be included in the contentsinfo property that is already returned (new in 3.7). The app only needs the isexternalfile and repositorytype of the first file (the main file), we don't need to know all the repositories, but maybe some other client wants the full list of repositories so it could be interesting to return the full list (in the right order).

      So IMO the WS should return the list of repositories and whether the first file is external or not.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                dpalou Dani Palou
                Peer reviewer:
                Dani Palou
                Integrator:
                Adrian Greeve
                Tester:
                Gladys Basiana
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias, Juan Leyva, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 10 minutes
                  4h 10m