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

New Web Service mod_data_approve_entry

    XMLWordPrintable

    Details

    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57921-master

      Description

      Approves and entry

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Pau Ferrer
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Jake Dallimore
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

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