From a85fdb55cd4d57aa5cdc71f2768b9c92f66982aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Wed, 29 Sep 2010 16:54:16 +0000 Subject: [PATCH] Allow to add events to group calendars via CalDAV --- calendar/inc/class.calendar_groupdav.inc.php | 2 +- calendar/inc/class.calendar_ical.inc.php | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_groupdav.inc.php b/calendar/inc/class.calendar_groupdav.inc.php index 743b265352..53d9975307 100644 --- a/calendar/inc/class.calendar_groupdav.inc.php +++ b/calendar/inc/class.calendar_groupdav.inc.php @@ -484,7 +484,7 @@ error_log(__METHOD__."($path,,".array2string($start).") filter=".array2string($f return $oldEvent; } - if (is_null($oldEvent) && !$this->bo->check_perms(EGW_ACL_ADD, 0, $user)) + if (is_null($oldEvent) && ($user >= 0) && !$this->bo->check_perms(EGW_ACL_ADD, 0, $user)) { // we have no add permission on this user's calendar if ($this->debug) error_log(__METHOD__."(,$user) we have not enough rights on this calendar"); diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index ae813d6f89..68f7bedd10 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -1343,15 +1343,25 @@ class calendar_ical extends calendar_boupdate if (!is_null($user)) { - if ($this->check_perms(EGW_ACL_ADD, 0, $user)) + if (($user >= 0 ) && $this->check_perms(EGW_ACL_ADD, 0, $user)) { $event['owner'] = $user; } - else + elseif ($user >= 0) { date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); return 0; // no permission } + else + { + // Add Group a invitation + $event['owner'] = $this->user; + if (!isset($event['participants'][$this->user])) + { + $event['participants'][$this->user] = calendar_so::combine_status('A', 1, 'CHAIR'); + } + $event['participants'][$user] = calendar_so::combine_status('U'); + } } // check if an owner is set and the current user has add rights // for that owners calendar; if not set the current user