MDL-32630 workshop_calendar_update() does not check for calendar permissions

As discussed in MDL-32631, calendar_event::update() should not do
capability checks at all. Until that issue is fixed, we just explicitly
declare that no capability checks should be done.

The function workshop_calendar_update() is executed when adding or
updating a workshop instance (where permissions to modify the instance
were already checked and are sufficient) and in the upgrade code (where
no check should be performed anyway).
This commit is contained in:
David Mudrak
2012-04-25 16:05:42 +02:00
parent bd44a3bc02
commit 8683c24f73
+12 -8
View File
@@ -1440,8 +1440,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) {
// should not be set but just in case
unset($event->id);
}
// calendar_event::create will reuse a db record if the id field is set
calendar_event::create($event);
// update() will reuse a db record if the id field is set
$eventobj = new calendar_event($event);
$eventobj->update($event, false);
}
if ($workshop->submissionend) {
@@ -1454,8 +1455,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) {
// should not be set but just in case
unset($event->id);
}
// calendar_event::create will reuse a db record if the id field is set
calendar_event::create($event);
// update() will reuse a db record if the id field is set
$eventobj = new calendar_event($event);
$eventobj->update($event, false);
}
if ($workshop->assessmentstart) {
@@ -1468,8 +1470,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) {
// should not be set but just in case
unset($event->id);
}
// calendar_event::create will reuse a db record if the id field is set
calendar_event::create($event);
// update() will reuse a db record if the id field is set
$eventobj = new calendar_event($event);
$eventobj->update($event, false);
}
if ($workshop->assessmentend) {
@@ -1482,8 +1485,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) {
// should not be set but just in case
unset($event->id);
}
// calendar_event::create will reuse a db record if the id field is set
calendar_event::create($event);
// update() will reuse a db record if the id field is set
$eventobj = new calendar_event($event);
$eventobj->update($event, false);
}
// delete any leftover events