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

New Web Service mod_workshop_delete_submission

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.4
    • Component/s: Workshop
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a course with a workshop
      2. Enrol one user as student and another one as teacher
      3. All the required information in the workshop to switch to the submisson phase
      4. As the student, do a submission
      5. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      6. Create a Token in the mobile app service for the student and the teacher:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the student.
        • You need to replace the wstoken with the student one, submissionid (the submission to be deleted id, you can get it from the workshop_submissions table) and the URL of your moodle instance

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

      8. Check that the returned includes a field status set to true
      9. Go to the Moodle web interface, log in as student and check that the submission is not displayed any more
      10. Enrol other user as student in the course
      11. Now, in the moodle web site create another submission but using the user account created in the previous step
      12. Execute again the first curl request (using the new created submission id but not changing the rest of parameters)
      13. You should get an exception because you are trying to delete other user's submission
      14. Now, execute the last curl request but replacing the wstoken with the teacher one. The submission should be deleted.
      15. Now, using the student account that has the wstoken create another submission in the site
      16. Now, as teacher switch to the assessment phase (doing the allocation and all required steps)
      17. Execute the first curl request again using the last submission created id and the student wstoken.
      18. You should get an exception because you are not able to delete submissions in the assessment phase
      Show
      Create a course with a workshop Enrol one user as student and another one as teacher All the required information in the workshop to switch to the submisson phase As the student, do a submission Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student and the teacher: 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 with the student one, submissionid (the submission to be deleted id, you can get it from the workshop_submissions table) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'submissionid=12&wsfunction=mod_workshop_delete_submission&moodlewssettingfilter=true' | python -m "json.tool" Check that the returned includes a field status set to true Go to the Moodle web interface, log in as student and check that the submission is not displayed any more Enrol other user as student in the course Now, in the moodle web site create another submission but using the user account created in the previous step Execute again the first curl request (using the new created submission id but not changing the rest of parameters) You should get an exception because you are trying to delete other user's submission Now, execute the last curl request but replacing the wstoken with the teacher one. The submission should be deleted. Now, using the student account that has the wstoken create another submission in the site Now, as teacher switch to the assessment phase (doing the allocation and all required steps) Execute the first curl request again using the last submission created id and the student wstoken. You should get an exception because you are not able to delete submissions in the assessment phase
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59244-master

      Description

      To delete a submission by id.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17