MDL-59671 core_calendar: create calendar_delete_event_allowed function

This commit is contained in:
Simey Lameze
2017-08-09 14:47:35 +08:00
parent 2defbefe8c
commit dadd6f9fcc
+11
View File
@@ -2493,6 +2493,17 @@ function calendar_edit_event_allowed($event) {
return false;
}
/**
* Return the capability for deleting a calendar event.
*
* @param calendar_event $event The event object
* @return bool Whether the user has permission to delete the event or not.
*/
function calendar_delete_event_allowed($event) {
// Only allow delete if you have capabilities and it is not an module event.
return (calendar_edit_event_allowed($event) && empty($event->modulename));
}
/**
* Returns the default courses to display on the calendar when there isn't a specific
* course to display.