Safe Unauthenticated Free/Busy for Roaming Users (Bifrost#T36327) - display the URL in calendar

This commit is contained in:
Aleksander Machniak 2017-08-01 12:54:54 +02:00
parent bd7fe38996
commit a2a1d5e99d
6 changed files with 51 additions and 1 deletions

View file

@ -1732,6 +1732,18 @@ class calendar extends rcube_plugin
$settings['identity'] = array('name' => $identity['name'], 'email' => strtolower($identity['email']), 'emails' => ';' . strtolower(join(';', $identity['emails'])));
}
// freebusy token authentication URL
if (($url = $this->rc->config->get('calendar_freebusy_session_auth_url'))
&& ($uniqueid = $this->rc->config->get('kolab_uniqueid'))
) {
if ($url === true) $url = '/freebusy';
$url = rtrim(rcube_utils::resolve_url($url), '/ ');
$url .= '/' . urlencode($this->rc->get_user_name());
$url .= '/' . urlencode($uniqueid);
$settings['freebusy_url'] = $url;
}
return $settings;
}

View file

@ -3200,6 +3200,27 @@ function rcube_calendar_ui(settings)
}
};
// show free-busy URL in a dialog box
this.showfburl = function()
{
var $dialog = $('#fburlbox');
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
$dialog.dialog({
resizable: true,
closeOnEscape: true,
title: rcmail.gettext('showfburl', 'calendar'),
close: function() {
$dialog.dialog("destroy").hide();
},
width: 520
}).show();
$('#fburl').val(settings.freebusy_url).select();
};
// refresh the calendar view after saving event data
this.refresh = function(p)
{
@ -3601,7 +3622,7 @@ function rcube_calendar_ui(settings)
calendars_list.addEventListener('select', function(node) {
if (node && node.id && me.calendars[node.id]) {
me.select_calendar(node.id, true);
rcmail.enable_command('calendar-edit', 'calendar-showurl', true);
rcmail.enable_command('calendar-edit', 'calendar-showurl', 'calendar-showfburl', true);
rcmail.enable_command('calendar-delete', me.calendars[node.id].editable);
rcmail.enable_command('calendar-remove', me.calendars[node.id] && me.calendars[node.id].removable);
}
@ -4162,6 +4183,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
rcmail.register_command('calendar-delete', function(){ cal.calendar_delete(cal.calendars[cal.selected_calendar]); }, false);
rcmail.register_command('events-import', function(){ cal.import_events(cal.calendars[cal.selected_calendar]); }, true);
rcmail.register_command('calendar-showurl', function(){ cal.showurl(cal.calendars[cal.selected_calendar]); }, false);
rcmail.register_command('calendar-showfburl', function(){ cal.showfburl(); }, false);
rcmail.register_command('event-download', function(){ cal.event_download(cal.selected_event); }, true);
rcmail.register_command('event-sendbymail', function(p, obj, e){ cal.event_sendbymail(cal.selected_event, e); }, true);
rcmail.register_command('event-copy', function(){ cal.event_copy(cal.selected_event); }, true);

View file

@ -166,4 +166,9 @@ $config['kolab_invitation_calendars'] = false;
// LDAP directory configuration to find avilable resources for events
// $config['calendar_resources_directory'] = array(/* ldap_public-like address book configuration */);
// Enables displaying of free-busy URL with token-based authentication
// Set it to the prefix URL, e.g. 'https://hostname/freebusy' or just '/freebusy'.
// See freebusy_session_auth in configuration of kolab_auth plugin.
$calendar['calendar_freebusy_session_auth_url'] = null;
?>

View file

@ -112,6 +112,8 @@ $labels['nmonthsback'] = '$nr months back';
$labels['showurl'] = 'Show calendar URL';
$labels['showurldescription'] = 'Use the following address to access (read only) your calendar from other applications. You can copy and paste this into any calendar software that supports the iCal format.';
$labels['caldavurldescription'] = 'Copy this address to a <a href="http://en.wikipedia.org/wiki/CalDAV" target="_blank">CalDAV</a> client application (e.g. Evolution or Mozilla Thunderbird) to fully synchronize this specific calendar with your computer or mobile device.';
$labels['showfburl'] = 'Show free-busy URL';
$labels['fburldescription'] = 'Use the following address to access Free-Busy information from other applications. You can copy and paste this into any calendar software that supports free-busy information in iCal format. No authentication is required for this URL.';
$labels['findcalendars'] = 'Find calendars...';
$labels['searchterms'] = 'Search terms';
$labels['calsearchresults'] = 'Available Calendars';

View file

@ -433,6 +433,7 @@ pre {
background-color: #c7e3ef;
}
#fburl,
#calfeedurl,
#caldavurl {
width: 98%;

View file

@ -74,6 +74,9 @@
<li role="menuitem"><roundcube:button type="link" command="calendar-remove" label="calendar.removelist" classAct="active" /></li>
<roundcube:endif />
<li role="menuitem"><roundcube:button type="link" command="calendar-showurl" label="calendar.showurl" classAct="active" /></li>
<roundcube:if condition="!empty(env:calendar_settings['freebusy_url'])" />
<li role="menuitem"><roundcube:button type="link" command="calendar-showfburl" label="calendar.showfburl" classAct="active" /></li>
<roundcube:endif />
<roundcube:if condition="env:calendar_driver == 'kolab'" />
<li role="menuitem"><roundcube:button type="link" command="folders" task="settings" label="managefolders" classAct="active" /></li>
<roundcube:endif />
@ -361,6 +364,11 @@
</div>
</div>
<div id="fburlbox" class="uidialog">
<p><roundcube:label name="calendar.fburldescription" /></p>
<textarea id="fburl" rows="2" readonly="readonly"></textarea>
</div>
<roundcube:object name="plugin.calendar_css" />
<script type="text/javascript">