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

webservice/pluginfile.php is missing the new offline parameter (and also old parameter) from pluginfile.php

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      2. Create a Token for a user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Configure your site to use the Google Oauth: https://docs.moodle.org/dev/OAuth2_Services.
      4. Enable the Google Drive repository and assign the Google OAuth 2 service to it.
      5. Make sure to set "Supported files" to "Internal and External" and "Default return type" to "External (only links stored in Moodle)"
      6. Now go back to to Site administration > Server > OAuth 2 Services and connect a system account for the Google OAuth 2 service.
      7. Create a course and enrol the user from step 2.
      8. Create a File resource from the Google Drive repository. Make sure to select "Create an access controlled link to the file" and set Display to Embed.
      9. Open the File resource, inspect the page and copy the URL from the iframe. It should be something like this:
        https://YOURSITE/pluginfile.php/180/mod_resource/content/2/File.gdoc
      10. Now you'll have to modify the URL you copied in the previous step. Add webservice/ right before pluginfile.php, and also add the user token as a param at the end. Using the example for the previous step:
        https://YOURSITE/webservice/pluginfile.php/180/mod_resource/content/2/File.gdoc?token=2155003aac9cf435ac186fb9c64fec39
      11. Open this URL in a browser. You should get this error:

        {"error":"Unsupported redirect detected, script execution terminated","errorcode":"redirecterrordetected","stacktrace":null,"debuginfo":null,"reproductionlink":null}
        

      12. Now add &offline=1 at the end of the URL and try again. Now the file should be displayed or downloaded (depending on the extension)
      Show
      As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for a user. Click on Site administration ► Plugins ► Web services ► Manage tokens Configure your site to use the Google Oauth: https://docs.moodle.org/dev/OAuth2_Services . Enable the Google Drive repository and assign the Google OAuth 2 service to it. Make sure to set " Supported files " to " Internal and External " and " Default return type " to " External (only links stored in Moodle) " Now go back to to Site administration > Server > OAuth 2 Services and connect a system account for the Google OAuth 2 service. Create a course and enrol the user from step 2. Create a File resource from the Google Drive repository. Make sure to select " Create an access controlled link to the file " and set Display to Embed . Open the File resource, inspect the page and copy the URL from the iframe. It should be something like this: https://YOURSITE/pluginfile.php/180/mod_resource/content/2/File.gdoc Now you'll have to modify the URL you copied in the previous step. Add webservice/ right before pluginfile.php, and also add the user token as a param at the end. Using the example for the previous step: https://YOURSITE/webservice/pluginfile.php/180/mod_resource/content/2/File.gdoc?token=2155003aac9cf435ac186fb9c64fec39 Open this URL in a browser. You should get this error: {"error":"Unsupported redirect detected, script execution terminated","errorcode":"redirecterrordetected","stacktrace":null,"debuginfo":null,"reproductionlink":null} Now add &offline=1 at the end of the URL and try again. Now the file should be displayed or downloaded (depending on the extension)
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58741-master

      Description

      MDL-58334 and MDL-32471 introduced new parameters in pluginfile.php but they are missing from webservice/pluginfile.php

      We need the offline one in the Mobile app (this new parameter was designed thinking in the mobile app)

        Attachments

          Activity

            People

            • Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Pau Ferrer
              Integrator:
              Jun Pataleta
              Tester:
              Dan Poltawski
              Participants:
              Component watchers:
              Juan Leyva, Jake Dallimore, Jun Pataleta
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/17