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

New Web Service core_user_get_private_files_info

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.2.2
    • 3.4
    • Web Services
    • MOODLE_32_STABLE
    • MOODLE_34_STABLE
    • MDL-58712-master
    • 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)

    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

              jleyva Juan Leyva
              jleyva Juan Leyva
              Andrew Lyons Andrew Lyons
              Dan Poltawski Dan Poltawski
              John Okely John Okely
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/Nov/17