do NOT push participants of type email for privacy reasons

This commit is contained in:
Ralf Becker 2020-07-23 19:05:49 +02:00
parent 0cea328928
commit efaf9771d0
2 changed files with 23 additions and 2 deletions

View File

@ -92,7 +92,8 @@ namespace EGroupware\Api;
* 'fetch' => 'app.class.method', // method to return entry data for a given id. the method called should support id, and expected mime-type * 'fetch' => 'app.class.method', // method to return entry data for a given id. the method called should support id, and expected mime-type
* // basically you should return something like array(id, title, mimetype, body, linked-files) * // basically you should return something like array(id, title, mimetype, body, linked-files)
* *
* 'push_data' => "key" | ["key1", ...] // keys of ACL relevant and privacy save data needed for push of changes to client * 'push_data' => <callable> | "key" | ["key1", ...] // keys of ACL relevant and privacy save data needed for push of changes to client
* // or callable to do the cleaning eg. used in calendar
* *
* 'additional' => array( // allow one app to register sub-types, * 'additional' => array( // allow one app to register sub-types,
* 'app-sub' => array( // different from 'types' approach above * 'app-sub' => array( // different from 'types' approach above

View File

@ -68,10 +68,30 @@ class calendar_hooks
'merge' => true, 'merge' => true,
'entry' => 'Event', 'entry' => 'Event',
'entries' => 'Events', 'entries' => 'Events',
'push_data' => ['id','owner','participants','start','end'] 'push_data' => self::class.'::prepareEventPush',
); );
} }
/**
* Prepare event to be pushed via Link::notify_update()
*
* Remove privacy sensitive data:
* - participants of type email
*
* @param $event
* @return array
*/
static public function prepareEventPush($event)
{
$event = array_intersect_key($event, array_flip(['id','owner','participants','start','end']));
foreach($event['participants'] as $uid => $status)
{
if ($uid[0] === 'e') unset($event['participants'][$uid]);
}
return $event;
}
/** /**
* Hook called to retrieve a app specific exportLimit * Hook called to retrieve a app specific exportLimit
* *