disable avatar sharing link, as it currently destroys sessions for already logged in users, plus some more fixes for VC

This commit is contained in:
Ralf Becker 2020-04-07 16:16:31 +02:00
parent 99a9513236
commit a6e6393943
3 changed files with 25 additions and 7 deletions

View File

@ -35,12 +35,19 @@ class Photo
*/ */
protected $path; protected $path;
/**
* @var bool
*/
protected $no_sharing_link=false;
/** /**
* Contructor * Contructor
* *
* @param int|string|array $id_data contact-id, "account:$account_id", array with contact-data or email for gravatar-url * @param int|string|array $id_data contact-id, "account:$account_id", array with contact-data or email for gravatar-url
* @param boolean $no_sharing_link =false true: do NOT generate sharing link, as we currently destroy the EGroupware
* session, if the link is from an other EGroupware user
*/ */
function __construct($id_data) function __construct($id_data, $no_sharing_link=false)
{ {
if (is_array($id_data)) if (is_array($id_data))
{ {
@ -56,6 +63,7 @@ class Photo
//throw Api\Exception\NotFound("Contact '$id_data' not found!"); //throw Api\Exception\NotFound("Contact '$id_data' not found!");
} }
} }
$this->no_sharing_link = $no_sharing_link;
} }
/** /**
@ -127,6 +135,13 @@ class Photo
{ {
return $this->anonLavatar(); return $this->anonLavatar();
} }
// do we want a sharing link or not
if ($this->no_sharing_link)
{
return Api\Framework::getUrl(Api\Egw::link('/api/avatar.php', [
'contact_id' => $this->contact['id'],
]));
}
// if we got photo, we have to create a temp. file to share // if we got photo, we have to create a temp. file to share
if ($path[0] !== '/') if ($path[0] !== '/')
{ {

View File

@ -815,9 +815,10 @@ class calendar_boupdate extends calendar_bo
* @param array $old_event Event before the change * @param array $old_event Event before the change
* @param array $new_event =null Event after the change * @param array $new_event =null Event after the change
* @param int|string $user =0 User/participant who started the notify, default current user * @param int|string $user =0 User/participant who started the notify, default current user
* @param array $alarm =null values for "offset", "start", etc.
* @return bool true/false * @return bool true/false
*/ */
function send_update($msg_type,$to_notify,$old_event,$new_event=null,$user=0) function send_update($msg_type, $to_notify, $old_event, $new_event=null, $user=0, array $alarm=null)
{ {
//error_log(__METHOD__."($msg_type,".array2string($to_notify).",...) ".array2string($new_event)); //error_log(__METHOD__."($msg_type,".array2string($to_notify).",...) ".array2string($new_event));
if (!is_array($to_notify)) if (!is_array($to_notify))
@ -1052,7 +1053,9 @@ class calendar_boupdate extends calendar_bo
if (!empty($event['##videoconference']) && class_exists('EGroupware\\Status\\Videoconference\\Call')) if (!empty($event['##videoconference']) && class_exists('EGroupware\\Status\\Videoconference\\Call'))
{ {
$avatar = new Api\Contacts\Photo(is_numeric($userid) ? "account:$userid" : $avatar = new Api\Contacts\Photo(is_numeric($userid) ? "account:$userid" :
(isset($res_info) && $res_info['type'] === 'c' ? $res_info['res_id'] : $userid)); (isset($res_info) && $res_info['type'] === 'c' ? $res_info['res_id'] : $userid),
// disable sharing links currently, as sharing links from a different EGroupware user destroy the session
true);
$details['videoconference'] = EGroupware\Status\Videoconference\Call::genMeetingUrl($event['##videoconference'], [ $details['videoconference'] = EGroupware\Status\Videoconference\Call::genMeetingUrl($event['##videoconference'], [
'name' => $fullname, 'name' => $fullname,
@ -1154,7 +1157,7 @@ class calendar_boupdate extends calendar_bo
'id' => $event['id'], 'id' => $event['id'],
'app' => 'calendar', 'app' => 'calendar',
'videoconference' => $details['videoconference'], 'videoconference' => $details['videoconference'],
)); ) + ($alarm ? ['alarm-offset' => (int)$alarm['offset']] : []));
} }
if ($m_type === MSG_ALARM) $notification->set_popupdata('calendar', array('egw_pr_notify' => 1, 'type' => $m_type)); if ($m_type === MSG_ALARM) $notification->set_popupdata('calendar', array('egw_pr_notify' => 1, 'type' => $m_type));
$notification->set_popupmessage($subject."\n\n".$notify_body."\n\n".$details['description']."\n\n".$details_body."\n\n"); $notification->set_popupmessage($subject."\n\n".$notify_body."\n\n".$details['description']."\n\n".$details_body."\n\n");
@ -1243,7 +1246,7 @@ class calendar_boupdate extends calendar_bo
Api\Translation::add_app('calendar'); Api\Translation::add_app('calendar');
$GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar';
$ret = $this->send_update(MSG_ALARM,$to_notify,$event,False,$alarm['owner']); $ret = $this->send_update(MSG_ALARM, $to_notify, $event, False, $alarm['owner'], $alarm);
// create a new alarm for recuring events for the next event, if one exists // create a new alarm for recuring events for the next event, if one exists
if ($event['recur_type'] != MCAL_RECUR_NONE && ($event = $this->read($alarm['cal_id'],$event_time_user+1))) if ($event['recur_type'] != MCAL_RECUR_NONE && ($event = $this->read($alarm['cal_id'],$event_time_user+1)))

View File

@ -251,7 +251,7 @@ class calendar_uiforms extends calendar_ui
// add automatic alarm 5min before videoconference for all participants // add automatic alarm 5min before videoconference for all participants
if (!empty($_GET['videoconference'])) if (!empty($_GET['videoconference']))
{ {
$offset = -5 * 60; $offset = 5 * 60;
$alarms[1+count($alarms)] = array( $alarms[1+count($alarms)] = array(
'offset' => $offset, 'offset' => $offset,
'time' => $start - $offset, 'time' => $start - $offset,
@ -274,7 +274,7 @@ class calendar_uiforms extends calendar_ui
'recur_exception' => array(), 'recur_exception' => array(),
'title' => $title ? $title : '', 'title' => $title ? $title : '',
'category' => $cat_id, 'category' => $cat_id,
'##videoconference' => !empty($_GET['videoconference']), 'videoconference' => !empty($_GET['videoconference']),
'##notify_externals' => !empty($_GET['videoconference']) ? 'yes' : $this->cal_prefs['notify_externals'], '##notify_externals' => !empty($_GET['videoconference']) ? 'yes' : $this->cal_prefs['notify_externals'],
); );
} }