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

New Web Service mod_data_get_data_access_information

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57916-master
    • 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

      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

            jleyva Juan Leyva
            jleyva Juan Leyva
            Pau Ferrer Pau Ferrer
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Mathieu Petit-Clair Mathieu Petit-Clair
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.