* Calendar/CalDAV: set current user as owner for events created in resource calendar

This commit is contained in:
ralf 2023-04-05 16:08:36 +02:00
parent 819b277c24
commit ccd6acd606
3 changed files with 11 additions and 5 deletions

View File

@ -99,7 +99,7 @@ class calendar_bo
*/ */
var $customfields = array(); var $customfields = array();
/** /**
* @var int $user nummerical id of the current user-id * @var int $user numerical id of the current user-id
*/ */
var $user=0; var $user=0;

View File

@ -20,7 +20,7 @@ use EGroupware\Api\Acl;
* Permanent error_log() calls should use $this->caldav->log($str) instead, to be send to PHP error_log() * Permanent error_log() calls should use $this->caldav->log($str) instead, to be send to PHP error_log()
* and our request-log (prefixed with "### " after request and response, like exceptions). * and our request-log (prefixed with "### " after request and response, like exceptions).
* *
* @ToDo: new properties on calendars and it's ressources specially from sharing: * @ToDo: new properties on calendars and it's resources specially from sharing:
* - for the invite property: 5.2.2 in https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing.txt * - for the invite property: 5.2.2 in https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing.txt
* - https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-schedulingchanges.txt * - https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-schedulingchanges.txt
*/ */

View File

@ -1543,6 +1543,12 @@ class calendar_ical extends calendar_boupdate
} }
} }
// check if event was created in a non-user calendar, e.g. a resource calendar --> set current user as owner
if (!is_numeric($event['owner']))
{
$event['owner'] = $this->user;
}
// update alarms depending on the given event type // update alarms depending on the given event type
if (count($event['alarm']) > 0 || isset($this->supportedFields['alarm']) && isset($event['alarm'])) if (count($event['alarm']) > 0 || isset($this->supportedFields['alarm']) && isset($event['alarm']))
{ {
@ -2813,7 +2819,7 @@ class calendar_ical extends calendar_boupdate
{ {
$event['organizer'] = $attributes['params']['CN'].' <'.$event['organizer'].'>'; $event['organizer'] = $attributes['params']['CN'].' <'.$event['organizer'].'>';
} }
// fall throught // fall through
case 'ATTENDEE': case 'ATTENDEE':
// work around Ligthning sending @ as %40 // work around Ligthning sending @ as %40
$attributes['value'] = str_replace('%40', '@', $attributes['value']); $attributes['value'] = str_replace('%40', '@', $attributes['value']);
@ -3091,7 +3097,7 @@ class calendar_ical extends calendar_boupdate
case 'ATTACH': case 'ATTACH':
if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code
// fall throught to store external attachment url // fall through to store external attachment url
default: // X- attribute or other by EGroupware unsupported property default: // X- attribute or other by EGroupware unsupported property
//error_log(__METHOD__."() $attributes[name] = ".array2string($attributes)); //error_log(__METHOD__."() $attributes[name] = ".array2string($attributes));
// for attributes with multiple values in multiple lines, merge the values // for attributes with multiple values in multiple lines, merge the values