Skip to content
Browse files

MDL-32630 workshop_calendar_update() does not check for calendar perm…

…issions

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).
  • Loading branch information...
1 parent 93fb7b5 commit 08258a6dfb095231e27fe509376495644578c3e2 @mudrd8mz mudrd8mz committed
Showing with 12 additions and 8 deletions.
  1. +12 −8 mod/workshop/lib.php
View
20 mod/workshop/lib.php
@@ -1441,8 +1441,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) {
@@ -1455,8 +1456,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) {
@@ -1469,8 +1471,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) {
@@ -1483,8 +1486,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

0 comments on commit 08258a6

Please sign in to comment.
Something went wrong with that request. Please try again.