forked from extern/egroupware
* Calendar/CalDAV: fixed event not show if user only participates in an exeception (not the master) and has no read-rights for any master participant
This commit is contained in:
parent
769399b0cc
commit
235172d623
@ -680,11 +680,11 @@ class calendar_bo
|
||||
'id' => $event['id'],
|
||||
'start' => $event['start'],
|
||||
'end' => $event['end'],
|
||||
'whole_day' => $event['whole_day'],
|
||||
'tzid' => $event['tzid'],
|
||||
'title' => lang('private'),
|
||||
'modified' => $event['modified'],
|
||||
'owner' => $event['owner'],
|
||||
'recur_type' => MCAL_RECUR_NONE,
|
||||
'uid' => $event['uid'],
|
||||
'etag' => $event['etag'],
|
||||
'participants' => array_intersect_key($event['participants'],array_flip($allowed_participants)),
|
||||
@ -692,7 +692,17 @@ class calendar_bo
|
||||
'category' => $event['category'], // category is visible anyway, eg. by using planner by cat
|
||||
'non_blocking' => $event['non_blocking'],
|
||||
'caldav_name' => $event['caldav_name'],
|
||||
);
|
||||
// we need full recurrence information, as they are relevant free/busy information
|
||||
)+($event['recur_type'] ? array(
|
||||
'recur_type' => $event['recur_type'],
|
||||
'recur_interval' => $event['recur_interval'],
|
||||
'recur_data' => $event['recur_data'],
|
||||
'recur_enddate' => $event['recur_enddate'],
|
||||
'recur_exception'=> $event['recur_exception'],
|
||||
):array(
|
||||
'reference' => $event['reference'],
|
||||
'recurrence' => $event['recurrence'],
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,7 +177,7 @@ class calendar_groupdav extends groupdav_handler
|
||||
|
||||
if ($path == '/calendar/')
|
||||
{
|
||||
$filter['filter'] = 'owner';
|
||||
$filter['filter'] = 'default';
|
||||
}
|
||||
// scheduling inbox, shows only not yet accepted or rejected events
|
||||
elseif (substr($path,-7) == '/inbox/')
|
||||
@ -647,10 +647,14 @@ class calendar_groupdav extends groupdav_handler
|
||||
);
|
||||
if (is_array($expand)) $params += $expand;
|
||||
|
||||
$events =& $bo->search($params);
|
||||
if (!($events =& $bo->search($params)))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
// find master, which is not always first event, eg. when first event is an exception
|
||||
$master = null;
|
||||
$exceptions = array();
|
||||
foreach($events as $k => &$recurrence)
|
||||
{
|
||||
if ($recurrence['recur_type'])
|
||||
@ -662,20 +666,18 @@ class calendar_groupdav extends groupdav_handler
|
||||
}
|
||||
}
|
||||
// if recurring event starts in future behind horizont, nothing will be returned by bo::search()
|
||||
if (!isset($master) && !($master = $bo->read($uid)))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
if (!isset($master)) $master = $bo->read($uid);
|
||||
|
||||
foreach($events as $k => &$recurrence)
|
||||
{
|
||||
//error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($uid)[$k]:" . array2string($recurrence));
|
||||
if ($recurrence['id'] != $master['id']) // real exception
|
||||
if (!$master || $recurrence['id'] != $master['id']) // real exception
|
||||
{
|
||||
// user is NOT participating in this exception
|
||||
if ($user && !self::isParticipant($recurrence, $user))
|
||||
{
|
||||
// if he is NOT in master, delete this exception
|
||||
if (!self::isParticipant($master, $user))
|
||||
if (!$master || !self::isParticipant($master, $user))
|
||||
{
|
||||
unset($events[$k]);
|
||||
continue;
|
||||
@ -695,14 +697,16 @@ class calendar_groupdav extends groupdav_handler
|
||||
continue; // nothing to change
|
||||
}
|
||||
// alarms are reported on recurrences --> move them to master
|
||||
foreach($recurrence['alarm'] as $alarm)
|
||||
if ($master)
|
||||
{
|
||||
$master['alarm'][] = $alarm;
|
||||
foreach($recurrence['alarm'] as $alarm)
|
||||
{
|
||||
$master['alarm'][] = $alarm;
|
||||
}
|
||||
$recurrence['alarm'] = array();
|
||||
}
|
||||
$recurrence['alarm'] = array();
|
||||
|
||||
// now we need to check if this recurrence is an exception
|
||||
if (!$expand && $master['participants'] == $recurrence['participants'])
|
||||
if (!$expand && $master && $master['participants'] == $recurrence['participants'])
|
||||
{
|
||||
//error_log('NO exception: '.array2string($recurrence));
|
||||
unset($events[$k]); // no exception --> remove it
|
||||
@ -711,12 +715,12 @@ class calendar_groupdav extends groupdav_handler
|
||||
// this is a virtual exception now (no extra event/cal_id in DB)
|
||||
//error_log('virtual exception: '.array2string($recurrence));
|
||||
$recurrence['recurrence'] = $recurrence['start'];
|
||||
$recurrence['reference'] = $master['id'];
|
||||
if ($master) $recurrence['reference'] = $master['id'];
|
||||
$recurrence['recur_type'] = MCAL_RECUR_NONE; // is set, as this is a copy of the master
|
||||
// not for included exceptions (Lightning): $master['recur_exception'][] = $recurrence['start'];
|
||||
}
|
||||
// only add master if we are not expanding and current user participates in master (and not just some exceptions)
|
||||
if (!$expand && (!$user || self::isParticipant($master, $user)))
|
||||
if (!$expand && $master && (!$user || self::isParticipant($master, $user)))
|
||||
{
|
||||
$events = array_merge(array($master), $events);
|
||||
}
|
||||
@ -1315,7 +1319,9 @@ class calendar_groupdav extends groupdav_handler
|
||||
$event = $this->bo->read(array($column => $id, 'cal_deleted IS NULL', 'cal_reference=0'), null, true, 'server');
|
||||
if ($event) $event = array_shift($event); // read with array as 1. param, returns an array of events!
|
||||
|
||||
if (!($retval = $this->bo->check_perms(EGW_ACL_FREEBUSY,$event, 0, 'server')))
|
||||
if (!($retval = $this->bo->check_perms(EGW_ACL_FREEBUSY,$event, 0, 'server')) &&
|
||||
// above can be true, if current user is not in master but just a recurrence
|
||||
(!$event['recur_type'] || !($events = self::get_series($event['uid'], $this->bo))))
|
||||
{
|
||||
if ($this->debug > 0) error_log(__METHOD__."($id) no READ or FREEBUSY rights returning ".array2string($retval));
|
||||
return $retval;
|
||||
|
Loading…
Reference in New Issue
Block a user