MDL-59393 calendar: use event context in update_event_start_day

This commit is contained in:
Ryan Wyllie 2017-08-23 01:32:51 +00:00
parent 28e030d9f9
commit ca518350ff

View File

@ -947,9 +947,6 @@ class core_calendar_external extends external_api {
'dayTimestamp' => $dayTimestamp,
]);
$context = \context_user::instance($USER->id);
self::validate_context($context);
$vault = event_container::get_event_vault();
$mapper = event_container::get_event_mapper();
$event = $vault->get_event_by_id($eventId);
@ -964,6 +961,8 @@ class core_calendar_external extends external_api {
print_error('nopermissiontoupdatecalendar');
}
self::validate_context($legacyevent->context);
$newdate = usergetdate($dayTimestamp);
$startdatestring = implode('-', [$newdate['year'], $newdate['mon'], $newdate['mday']]);
$startdate = new DateTimeImmutable($startdatestring);