Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: Calendar, Web Services
    • Labels:
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:
      MDL-37077-master

      Description

      WS Api to delete calendar events

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/13