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

New Web Service mod_data_get_data_access_information

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a course with a database using the image gallery preset with a time restriction (not open yet)
      2. Enrol a couple of users as teacher and student in that course
      3. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token in the mobile app service for the student in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client with the student.
        • You need to replace the wstoken, databaseid (database instance id) and the URL of your moodle instance

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

      6. Now check that the field timeavailable is set to false
      7. Now, as teacher, edit the database removing the time restriction, change the settings to require a user at least to create 2 entries to view other user entries.
      8. As student in Moodle create a new entry in the database
      9. Execute the curl request again
      10. Check that timeavailable is set to true, canaddentry to true, entrieslefttoview is set to 1, inreadonlyperiod to false, numentries is set to 1
      Show
      Create a course with a database using the image gallery preset with a time restriction (not open yet) Enrol a couple of users as teacher and student in that course Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student in the course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student. You need to replace the wstoken, databaseid (database instance id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'databaseid=13&wsfunction=mod_data_get_data_access_information&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Now check that the field timeavailable is set to false Now, as teacher, edit the database removing the time restriction, change the settings to require a user at least to create 2 entries to view other user entries. As student in Moodle create a new entry in the database Execute the curl request again Check that timeavailable is set to true, canaddentry to true, entrieslefttoview is set to 1, inreadonlyperiod to false, numentries is set to 1
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57916-master

      Description

      To retrieve access information like user permissions and current default group in the database and event the number of entries, read only period, specific permissions calculated via functions like data_user_can_add_entry etc..

      In general all kind of information required by an external client to be able to interact properly with the rest of the Web Services

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Pau Ferrer
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Mathieu Petit-Clair
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

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