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

New Web Service mod_data_delete_entry

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a course with a database using the image gallery preset .
      2. Enrol a couple of users as teacher and student in that course
      3. As the student add 3 entries to the database.
      4. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. 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
      6. Next, you can do a CURL REST call simulating a WS client with the teacher token.
        • You need to replace the wstoken, entryid (one entry you want to delete) 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_delete_entry&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e&moodlewssettingfilter=true' | python -m "json.tool"

      7. Confirm that the entry is deleted
      8. Now, execute the same WS but using the student wstoken and the other entry id
      9. Confirm that the other entry is deleted
      10. Now, set a read only period for the database (set the start date to one day ago and the end date to tomorrow)
      11. Now, using the student wstoken and pointing to the last entry id execute the curl request
      12. Confirm that you get a "noaccess" exception. The reason is that you are in read only period so you can't delete entries.
      Show
      Create a course with a database using the image gallery preset . Enrol a couple of users as teacher and student in that course As the student add 3 entries to the database. 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 (one entry you want to delete) 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_delete_entry&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e&moodlewssettingfilter=true' | python -m "json.tool" Confirm that the entry is deleted Now, execute the same WS but using the student wstoken and the other entry id Confirm that the other entry is deleted Now, set a read only period for the database (set the start date to one day ago and the end date to tomorrow) Now, using the student wstoken and pointing to the last entry id execute the curl request Confirm that you get a "noaccess" exception. The reason is that you are in read only period so you can't delete entries.
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57922-master

      Description

      Deletes an entry

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Andrew Nicols
              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:
              2 Start watching this issue

                Dates

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