mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
MDL-59393 calendar: stop user editing module events
This commit is contained in:
parent
5ca142dc5b
commit
909d08588d
5 changed files with 72 additions and 5 deletions
|
@ -2435,9 +2435,10 @@ function calendar_set_filters(array $courseeventsfrom, $ignorefilters = false) {
|
|||
* Return the capability for editing calendar event.
|
||||
*
|
||||
* @param calendar_event $event event object
|
||||
* @param bool $manualedit is the event being edited manually by the user
|
||||
* @return bool capability to edit event
|
||||
*/
|
||||
function calendar_edit_event_allowed($event) {
|
||||
function calendar_edit_event_allowed($event, $manualedit = false) {
|
||||
global $USER, $DB;
|
||||
|
||||
// Must be logged in.
|
||||
|
@ -2450,6 +2451,12 @@ function calendar_edit_event_allowed($event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($manualedit && !empty($event->modulename)) {
|
||||
// A user isn't allowed to directly edit an event generated
|
||||
// by a module.
|
||||
return false;
|
||||
}
|
||||
|
||||
// You cannot edit URL based calendar subscription events presently.
|
||||
if (!empty($event->subscriptionid)) {
|
||||
if (!empty($event->subscription->url)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue