CalDAV
******


Configuration
=============

When "caldav" is included in the "httpmodules" option, the CalDAV
module allows Cyrus to function as a calendar and scheduling server.
This module uses a subset of the mailbox hierarchy as calendar
collections, the toplevel of which is specified by the
"calendarprefix" option. The public calendar hierarchy will reside at
the toplevel of the shared mailbox namespace. A user's personal
calendar hierarchy will be a child of their Inbox.

For example, using the default value for calendarprefix, a calendar
named Default for user "murch" would reside in the mailbox named
"user.murch.#calendars.Default".

Warning:

  Note that mailboxes in the calendar hierarchies (those under
  calendarprefix) **should not** be accessed with an IMAP client as
  doing so will leave a mailbox in a state unsuitable for CalDAV. To
  this end, calendar mailboxes will not returned by Cyrus imapd in
  response to an IMAP client's request for the available calendar
  list, but Cyrus imapd can not otherwise prevent an IMAP client from
  accessing them.

By default, the CalDAV module will automatically perform scheduling
operations when a scheduling object (invite or reply) is stored on or
deleted from the server. Support for the calendar-auto-schedule
feature can be disabled with the "caldav_allowscheduling" option.


Administration
==============

The CalDAV module will *automatically* create the required calendars
for a user the first time that the user authenticates to the CalDAV
server. Note that the user MUST have an existing IMAP Inbox in order
for the calendars to be created.

Autocreate of the various calendars can be disabled with the
"caldav_create_default", "caldav_create_attach", and
"caldav_create_sched" options, if you have an alternate mechanism to
create calendars.

There is also a Cyrus web GUI for managing calendar resources. It
allows you to:

   * Create new collections, with whichever components are required

   * Alter existing collections

   * Subscribe or download existing collections via prepared URLs

   * Set visibility attributes such as Public or Transparent

   * Delete existing collections

To delete the value of a property, click on ✎ and then submit empty
new value.

The Name, Description, Color, and Order properties are used only for
UI purposes.  “None color” means, that no calendar color is
communicated to the calendar user agents.  Transparent calendars are
skipped by server-side freebusy calculations.  The Time Zone on
calendars is used to calculate the freebusy state on events with
floating times.  Public toggles the *lrw9* rights for the *anyone*
user.

The Cyrus web GUI for CalDAV Collection Management is disabled by
default, but can be enabled with the "caldav_allowcalendaradmin"
option.

To access the Cyrus web GUI for CalDAV Collection Management, point a
web browser at "https://<servername>/dav/calendars/user/<username>"


Calendar access controls
------------------------

The CalDAV module uses the same access controls as the other Cyrus
services. The cyradm(8) tool can be used to adjust ACLs on calendars
as needed. The tables below show how the access controls are used by
the CalDAV module.




Freebusy URL
============

When enabled in conjunction with the CalDAV module, the Freebusy URL
module allows non-CalDAV and/or remote calendaring clients to query
the freebusy information of Cyrus CalDAV users.

Access to the freebusy information is controlled by the "freebusy" ACL
(9) on a user's home calendar collection. (e.g. a mailbox named
"user.murch.#calendars"). To enable unauthenticated users (non-Cyrus)
to access freebusy information, the freebusy ACL must be given to
"anyone".

Freebusy information, consolidating the data of all user's calendars,
is accessed via URLs of the following form:
"https://<servername>/freebusy/user/<userid>".  Querying individual
CalDAV collections, when they have explicitly "freebusy" ACL (9) set,
is done via
"https://<servername>/freebusy/user/<userid>/<collection>".

Query parameters can be added to the URL per Section 4 of Freebusy
Read URL, allowing the user to choose to set the start, end, period
and format of their query results.


Time Zone Distribution Service (TZDist)
=======================================


What is TZDist
--------------

The TZDist module allows Cyrus to function as a Time Zone Distribution
Service (**RFC 7808** and **RFC 7809**), providing time zone data for
CalDAV and calendaring clients, without having to wait for their
client vendor and/or OS vendor to update the timezone information. The
responsibility for keeping the time zone information up to date then
falls upon the Cyrus administrator.

TZDist is optional: without Cyrus having TZDist enabled, calendar
clients should still be able to get their timezone information from
their client or their OS.

TZDist strips known VTIMEZONEs from incoming iCalendar data (as
advertised by the "calendar-no-timezone" DAV option from **RFC
7809**).


Configuration
-------------

The TZDist module requires the "zoneinfo_dir" setting to be set to the
directory where your time zone data is stored.

If "configure" found the "vzic" timezone compiler, "make install"
generates that data from the IANA time zone database bundled in
"tzdata/" and installs it under "<datadir>/cyrus-imapd/zoneinfo" --
e.g. "/usr/cyrus/share/cyrus-imapd/zoneinfo" -- and "zoneinfo_dir"
defaults to that directory.  In that case there is nothing to
configure, and you can skip to Administration, which you still need
when a new IANA release comes out.

The "configure" summary reports the directory as "time zone data" and
"zoneinfo_dir".  Note that this default is compiled in rather than
stored in the config file, so cyr_info(8) "conf-all" reports
"zoneinfo_dir" as empty unless it is set in imapd.conf(5) explicitly.

An upgraded installation keeps the "zoneinfo_dir" it has configured,
and its existing data stays in use.  To switch over to the data the
build installs, remove the setting from imapd.conf(5) and rebuild the
index as Administration describes.

Pass "--with-vzic=PATH" to "configure" if "vzic" is not on your
"PATH", or "--without-vzic" to build no time zone data at all and
manage "zoneinfo_dir" entirely yourself as described below.  Setting "
--with-zoneinfo-dir=PATH" overrides the default regardless.

Note:

  "vzic" hard-codes three settings when it is itself compiled, and
  "configure" cannot tell how the "vzic" it found was built:

  "TZID_PREFIX"
     The vendor prefix "vzic" writes on every "TZID",
     "/citadel.org/%D_1/" by default.  Cyrus needs bare IANA names,
     and the build strips any prefix from the data it generates.

  "CREATE_SYMLINK"
     Whether a time zone alias becomes a symlink to the zone it
     aliases rather than a VTIMEZONE of its own.  Either way works:
     Cyrus reads such a symlink as an alias, and "make install"
     installs it as a symlink.

  "IGNORE_TOP_LEVEL_LINK"
     Whether to skip the aliases that have no region, such as
     "EST5EDT". A "vzic" built with "IGNORE_TOP_LEVEL_LINK=1" writes
     no data at all for them, and Cyrus cannot tell that from an IANA
     release that never had them.  Build "vzic" with
     "IGNORE_TOP_LEVEL_LINK=0" to serve those time zones.

The data is indexed by a database whose location is specified by the
"zoneinfo_db_path" option, using the format specified by the
"zoneinfo_db" option.


Administration
--------------

The time zone data in "zoneinfo_dir" is the IANA Time Zone Database
(a.k.a. Olson Database) converted to the iCalendar format.  More than
TZDist reads it: CalDAV and JMAP Calendars expect a VTIMEZONE for
every IANA name, and JMAP Calendars also uses the guessing database
built from it to name the custom time zones that clients send -- see
cyr_guesstz(8).

Cyrus bundles a copy of the database in "tzdata/" and converts it
during the build, so a stock build starts out with current data.  What
the build cannot do is keep it current: IANA publishes several
releases a year, and installing them must be done by the packager or
the administrator.

Take one of the two routes below, then rebuild the index.


Updating the bundled data
~~~~~~~~~~~~~~~~~~~~~~~~~

"tzdata/" holds one unmodified IANA release.  "tools/update-tzdata.sh"
replaces it with a newer one -- it downloads the data-only tarball
from IANA, unpacks it over "tzdata/" and stages the result -- so that
"make install" produces the new data from then on:

   tools/update-tzdata.sh 2026d
   make && make install

This is also how the bundled copy gets updated for everybody, so a
pull request with that commit is welcome.


Managing zoneinfo_dir yourself
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you would rather not have the build touch your time zone data --
configure with "--without-vzic" -- then populate "zoneinfo_dir" by
hand.

vzic converts the IANA TZ DB to iCalendar format, writing a separate
file with its own TZID property for each time zone. Build it with
"TZID_PREFIX="" IGNORE_TOP_LEVEL_LINK=0": nothing strips the vendor
prefix for you here, since that is part of the build you just turned
off.  See the note above for what these settings mean.

The steps are:

1. Acquire and build your choice of "vzic" tool.

2. Download the latest version of the Time Zone Database data from
   IANA. Note you only need the **data**, not the code.

3. Expand the downloaded time zone data into a temporary directory of
   your choice.

4. Copy leap-seconds.list from the temporary directory to
   "<zoneinfo_dir>".

5. Populate "zoneinfo_dir" with iCalendar data:

   *Initial Install Only*

   1. Convert the raw data into iCalendar format by running vzic as
      follows: "vzic --pure --olson-dir <location-of-raw-data>
      --output-dir <zoneinfo_dir>"

      This will create and install iCalendar data directly into the
      "<zoneinfo_dir>" directory.

   *Updating Data Only*

   2. Convert the raw data into iCalendar format by running vzic as
      follows: "vzic --pure --olson-dir <location-of-raw-data>"

      This will create a zoneinfo/ subdirectory in your current
      location

   3. Merge new/updated iCalendar data into the "<zoneinfo_dir>"
      directory by running vzic-merge.pl in your current location:
      "vzic-merge.pl"

6. Copy the **version** file from the raw data to "<zoneinfo_dir>",
   and rebuild the timezone guessing database that JMAP CalendarEvent
   objects use:

      cyr_guesstz -z <zoneinfo_dir> <zoneinfo_dir>/guesstz.db

   See cyr_guesstz(8).  Skip this if Cyrus was built "--without-
   guesstz".


Rebuilding the index
~~~~~~~~~~~~~~~~~~~~

Either route ends here, whether the data came from the build or from
your own "vzic" run:

1. Rebuild the index by running ctl_zoneinfo(8):

      ctl_zoneinfo -r <version-string>

   where <version-string> contains a description of the time zone
   data, a colon, and the version of the data, e.g. ""IANA Time Zone
   Database:2026c"".  The version Cyrus built with is in the
   **version** file in "zoneinfo_dir".

2. Check that the zoneinfo index database and all iCalendar data
   files/links are readable by the cyrus user.


iSchedule
=========

In a Cyrus Murder with the CalDAV module and "caldav_allowscheduling"
enabled, a backend delivers a scheduling message to a user on another
backend using the iSchedule protocol, if its mailbox list includes
that user (as in a unified Murder). Each backend accepts these
messages only from servers listed in "proxyservers".

Cyrus does not exchange iSchedule messages with servers outside its
Murder. Scheduling with users elsewhere uses iMIP (email).
