Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29934 Web service API Roadmap
  3. MDL-37077

core_calendar_delete_calendar_events()

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5
    • 2.5
    • Calendar, Web Services
    • MOODLE_25_STABLE
    • MOODLE_25_STABLE
    • MDL-37077-master
    • Hide
      1. Run unit tests and make sure all is good
      2. Make sure the new calendar units tests are executed with the phpunit run. Check phpunit.xml and make sure there is an entry for calendar.
      3. Setup a ws client of your choice. (/moodle/admin/settings.php?section=webservicesoverview might help)
      4. create 6 calendar events (1 site, 1 course with 2 childern(using repeat in new event form), 1 group event, 1 user event)
      5. Goto event table in database using database browser of your choice and note the ids of each of them.
      6. Lets say the ids are 1, 2-3-4,5,6 respectively
      7. Assign a user the permission to make ws calls
      8. Enrol this user in the course and group for events above as student.
      9. Modfiy student role and remove the following permissions:-
        1. moodle/calendar:manageownentries from user context
        2. moodle/calendar:managegroupentries from course context
        3. moodle/calendar:manageentries from course context
        4. moodle/calendar:manageentries from site context (You will need to enable the student role for site context from admin>users>permissions>define role)
      10. try making the ws call to delete all events, param would be something like (assuming you are using xml rpc client, if you are using something else refer the api documentation for correct params format)

                $events = array(
                    array('eventid' => $siteevent->id, 'repeat' => 0),
                    array('eventid' => $courseevent->id, 'repeat' => 0),
                    array('eventid' => $userevent->id, 'repeat' => 0),
                    array('eventid' => $groupevent->id, 'repeat' => 0)
                );
        

        Since the user doesn't have the permissions the events should not be deleted.

      11. Give back the user cap 9.1 and make a ws call with the following param, and make sure it is deleted

                $events = array(
                    array('eventid' => $userevent->id, 'repeat' => 0),
                );
        

      12. Give back user all caps as step 9 and making delete call with following params:-

                $events = array(
                    array('eventid' => $siteevent->id, 'repeat' => 0),
                    array('eventid' => $courseevent->id, 'repeat' => 1),
                    array('eventid' => $groupevent->id, 'repeat' => 0)
                );
        

        Make sure all events are deleted.

      13. Treat yourself for getting through this crappy test
      Show
      Run unit tests and make sure all is good Make sure the new calendar units tests are executed with the phpunit run. Check phpunit.xml and make sure there is an entry for calendar. Setup a ws client of your choice. (/moodle/admin/settings.php?section=webservicesoverview might help) create 6 calendar events (1 site, 1 course with 2 childern(using repeat in new event form), 1 group event, 1 user event) Goto event table in database using database browser of your choice and note the ids of each of them. Lets say the ids are 1, 2-3-4,5,6 respectively Assign a user the permission to make ws calls Enrol this user in the course and group for events above as student. Modfiy student role and remove the following permissions:- moodle/calendar:manageownentries from user context moodle/calendar:managegroupentries from course context moodle/calendar:manageentries from course context moodle/calendar:manageentries from site context (You will need to enable the student role for site context from admin>users>permissions>define role) try making the ws call to delete all events, param would be something like (assuming you are using xml rpc client, if you are using something else refer the api documentation for correct params format) $events = array( array('eventid' => $siteevent->id, 'repeat' => 0), array('eventid' => $courseevent->id, 'repeat' => 0), array('eventid' => $userevent->id, 'repeat' => 0), array('eventid' => $groupevent->id, 'repeat' => 0) ); Since the user doesn't have the permissions the events should not be deleted. Give back the user cap 9.1 and make a ws call with the following param, and make sure it is deleted $events = array( array('eventid' => $userevent->id, 'repeat' => 0), ); Give back user all caps as step 9 and making delete call with following params:- $events = array( array('eventid' => $siteevent->id, 'repeat' => 0), array('eventid' => $courseevent->id, 'repeat' => 1), array('eventid' => $groupevent->id, 'repeat' => 0) ); Make sure all events are deleted. Treat yourself for getting through this crappy test

    Description

      WS Api to delete calendar events

      Attachments

        Issue Links

          Activity

            People

              ankit_frenz Ankit Agarwal
              ankit_frenz Ankit Agarwal
              Jérôme Mouneyrac Jérôme Mouneyrac
              Dan Poltawski Dan Poltawski
              David Monllaó David Monllaó
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/May/13