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

New Web Service mod_data_approve_entry

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57921-master
    • Hide
      1. Create a course with a database using the image gallery preset . Configure the database so new entries requires approval.
      2. Enrol a couple of users as teacher and student in that course
      3. As the student add a couple of entries to the database.
      4. As teacher approve just one of the entries.
      5. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      6. Create a Token in the mobile app service for the teacher and the student in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the teacher token.
        • You need to replace the wstoken, entryid (with the not yet approved entry id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'entryid=14&wsfunction=mod_data_approve_entry&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e&moodlewssettingfilter=true' | python -m "json.tool"

      8. Confirm that the entry is approved (you can view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 1)
      9. Now, execute the same WS but adding: approve=0
      10. Confirm that the entry is unapproved (you can't view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 0)
      11. Execute the same curl request but using the student token, confirm you receive an exception: required_capability_exception
      Show
      Create a course with a database using the image gallery preset . Configure the database so new entries requires approval. Enrol a couple of users as teacher and student in that course As the student add a couple of entries to the database. As teacher approve just one of the entries. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the teacher and 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 teacher token. You need to replace the wstoken, entryid (with the not yet approved entry id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'entryid=14&wsfunction=mod_data_approve_entry&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e&moodlewssettingfilter=true' | python -m "json.tool" Confirm that the entry is approved (you can view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 1) Now, execute the same WS but adding: approve=0 Confirm that the entry is unapproved (you can't view the entry in Moodle web with a different student account or you can check in the data_records table that the entry has approved set to 0) Execute the same curl request but using the student token, confirm you receive an exception: required_capability_exception

      Approves and entry

            jleyva Juan Leyva
            jleyva Juan Leyva
            Pau Ferrer Pau Ferrer
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Jake Dallimore Jake Dallimore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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