=============================================================== Developer Notes on WebDAV and `CalDAV`_/`CardDAV`_ Support in Horde =============================================================== This page is mostly based on Horde 5 and Horde master as of 12/2018 .. _`CalDAV`: https://wiki.horde.org/CalDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes Horde offers two different DAV endpoint types: - `CalDAV`_ and `CardDAV`_ are tied to the applications implementing the calendar/ and addressbooks/ api's - Generic WebDAV hierarchies may be implemented by any application. .. _`CalDAV`: https://wiki.horde.org/CalDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes ------------------------ Horde_Dav and SabreDAV ------------------------ Horde DAV support is implemented based on the SabreDAV library. As of 2018, it's SabreDAV 2.1 SabreDAV is wrapped in Horde_Dav. Horde_Dav implements or extends various interfaces and base classes used by SabreDAV. Horde_Auth is wrapped into Horde_Dav_Auth which extends the abstract SabreDAV auth backend. Horde_Dav_RootCollection implements a top node for a hierarchy of Horde_Dav_Collection items (DAV folders) Horde_Dav_Principals exposes users and groups as (principials) to SabreDAV. Shares/Resources owned by the system use the empty string in the horde shares backend, but use the string -system- in SabreDAV context. This conversion needs to be done by the implementing app, not by Horde_Dav. Horde_Dav_File implements a leaf node in DAV (a file) -------------------- `CalDAV`_ and `CardDAV`_ -------------------- The Horde_Dav caldav and `CardDAV`_ backends is accessed through the horde/base app's rpc endpoint /rpc/ or /rpc.php depending on config. This endpoint detects DAV and exposes three hierarchies rpc/addressbooks/ rpc/calendars/ rpc/principals/ .. _`CalDAV`: https://wiki.horde.org/CalDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes Horde_Dav_Storage maps the exposed name of caldav and carddav leaf objects (files) to collections. TODO: How are resources handled when they exist internally but the mapping is missing for some reasons like admin meddling in DB? `CalDAV`_ specifics ================ The `CalDAV`_ calendars backend relies on registry Api calls. Most of the code delegates finding the implementing horde app for a specific resource to the storage implementation's getCollectionInterface() method. However, the constructor explicitly only looks for the apps implementing the calendar api (kronolith) and the tasks api (nag). If another app implements the respective API's, it can substitute any of the two as a backend. However, it's currently not possible to directly expose a third app's resources to caldav. However, there is work to make kronolith expose other applications' timeobjects to caldav as a pass-through, just like in UI. .. _`CalDAV`: https://wiki.horde.org/CalDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CalDAV`: https://wiki.horde.org/CalDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes Currently, Horde_Dav does not allow adding new collections via `CalDAV`_. .. _`CalDAV`: https://wiki.horde.org/CalDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes `CardDAV`_ specifics ================= The `CardDAV`_ addressbooks backend relies on registry Api calls to whatever application implements the contacts api. Thus, only one application can interface addressbooks to `CardDAV`_. However, that application may or may not implement interfacing resources exposed by other apps. The default app to expose addressbooks is turba. .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes Flow: horde/rpc determines it is a webdav call and starts a Horde_Rpc_Webdav instance. This wraps Horde_Dav_Server, which is a SabreDAV server with a Horde_Dav `CardDAV`_ backend. This carddav backend is an app which implements the dav* methods in Application.php SabreDAV will handle the request and provide an answer to horde/rpc, using the Horde app as its storage backend. .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes -------- WebDAV -------- Generic WebDAV can be implemented by any app. It is exposed as rpc/$appname/ in the tree. Note how it uses the internal app name, not the name of a registry interface. An app needs to implement the following API methods to expose WebDAV folders and files: $App_Api::browse($path, $properties) returns a list of next level nodes relative to the path (files and collections) $App_Api::put($path, $content, $contentType) to support writing files path_delete($path) to delete either files or collections The app implementing these methods does not need to deal with any of the Horde_Dav related objects as Horde_Rpc_WebDAV and Horde_Dav handle these aspects. However, if the same resources are also exposed via `CalDAV`_/`CardDAV`_ Api, it might create inconsistency if a resource is created or deleted without Horde_Dav knowing. .. _`CalDAV`: https://wiki.horde.org/CalDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes .. _`CardDAV`: https://wiki.horde.org/CardDAV?referrer=Doc%2FDev%2FDAV%2FDeveloperNotes ------------------------------------ Notes on *dav lingo and principles ------------------------------------