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

New Web Service core_user_get_private_files_info

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.2
    • Fix Version/s: 3.4
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. As one normal user in the site add some files and directories to your private files area
      2. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      3. Create a Token in the mobile app service for the user used in step 1:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_user_get_private_files_info&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool"

      1. Now check that the WS response indicates the correct number of files and directories you added and the correct total size of the files you added
      2. Now, create a token for the admin user and execute the same curl request but replacing the token and appending &userid= (the user id used in step 1) and check that you receive the same information
      3. You can create a token for another normal user account and execute the latest curl request and check that in that case you receive an exception (you are not admin so you can't retrieve other users private files information)
      Show
      As one normal user in the site add some files and directories to your private files area As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the user used in step 1: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_user_get_private_files_info&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool" Now check that the WS response indicates the correct number of files and directories you added and the correct total size of the files you added Now, create a token for the admin user and execute the same curl request but replacing the token and appending &userid= (the user id used in step 1) and check that you receive the same information You can create a token for another normal user account and execute the latest curl request and check that in that case you receive an exception (you are not admin so you can't retrieve other users private files information)
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58712-master

      Description

      We need a WS that will return the remaining user quota in the private files are for the current user.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17