Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.6
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Setup

      1. Create an activity such as an assignment or database.
      2. Setup webservices for the api core_files_get_files()
        http://docs.moodle.org/25/en/Using_web_services
      3. In the above setup make sure the user you are going to use for making ws calls is admin or as all the permissions required to upload files to private area.
      4. Get your fav client from https://github.com/moodlehq/sample-ws-clients or use the one I use https://github.com/ankitagarwal/moodle-ws-client/blob/master/client.php (I have included files for this in the attachements section).

      Test - 1

      • Run unit tests and make sure they all pass. (files/tests/externallib_test.php)

      Test - 2

      Using the web services client with a context id.

      1. The easiest way to get all the information that you need is to open the database and look at the mdl_files records. This has the contextid, filearea, itemid, filepath, filename etc.
      1. Fill in the parameters in your webservices client. If you leave $filename blank, you will get more information.

      Make sure you can see information about the file.

      Test - 3

      Without context id

      1. Now fill in the parameters setting $contextid = -1 and filling in $contextlevel and $instanceid.
        • Contextlevel is probably something like 'module' depending on where you are looking for the file.
        • The instance id is the id for the module or something similar.

      Make sure that you get the same information back as when you used the context id.

      Show
      Setup Create an activity such as an assignment or database. Setup webservices for the api core_files_get_files() http://docs.moodle.org/25/en/Using_web_services In the above setup make sure the user you are going to use for making ws calls is admin or as all the permissions required to upload files to private area. Get your fav client from https://github.com/moodlehq/sample-ws-clients or use the one I use https://github.com/ankitagarwal/moodle-ws-client/blob/master/client.php (I have included files for this in the attachements section). Test - 1 Run unit tests and make sure they all pass. (files/tests/externallib_test.php) Test - 2 Using the web services client with a context id. The easiest way to get all the information that you need is to open the database and look at the mdl_files records. This has the contextid, filearea, itemid, filepath, filename etc. Fill in the parameters in your webservices client. If you leave $filename blank, you will get more information. Make sure you can see information about the file. Test - 3 Without context id Now fill in the parameters setting $contextid = -1 and filling in $contextlevel and $instanceid. Contextlevel is probably something like 'module' depending on where you are looking for the file. The instance id is the id for the module or something similar. Make sure that you get the same information back as when you used the context id.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-40038-master
    • Sprint:
      BACKEND Sprint 3

      Description

      Remove contextid from core_files_external::get_files, context should not be exposed externally

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              abgreeve Adrian Greeve
              Reporter:
              ankit_frenz Ankit Agarwal
              Peer reviewer:
              Frédéric Massart
              Integrator:
              Damyon Wiese
              Tester:
              Ankit Agarwal
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/13