From 90e3345440991a97f094f78b7cdb6aa7f62e25a8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 12 Nov 2021 13:36:10 -0500 Subject: [PATCH] implement Event::canEdit --- web/includes/Event.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web/includes/Event.php b/web/includes/Event.php index 328b06f66..e042849e9 100644 --- a/web/includes/Event.php +++ b/web/includes/Event.php @@ -650,6 +650,23 @@ class Event extends ZM_Object { } return false; } + function canEdit($u=null) { + global $user; + if (!$u) $u=$user; + if (!$u) { + # auth turned on and not logged in + return false; + } + if (!empty($u['MonitorIds']) ) { + if (!in_array($this->{'MonitorId'}, explode(',', $u['MonitorIds']))) { + return false; + } + } + if ($u['Events'] != 'Edit') { + return false; + } + return true; + } } # end class ?>