23 Commits

Author SHA1 Message Date
Alex Dunmow
089a0be495 caldav: sync-collection only on calendars, and review fixes
- sync-collection answers 403 unless the path is a calendar, and not a
  schedule inbox or outbox. A missing sync-level is level 1.
- DAV:sync-token is not returned for DAV:allprop (RFC 6578 section 4).
- schedule-response carries calendar-data only for a 2.x request-status.
- XML responses with a status other than 200 (207 and errors) set
  Content-Type before WriteHeader, so it is no longer dropped.
- Docs: sync-tokens are URIs; FreeBusyBackend advertises
  calendar-auto-schedule, so the backend owns scheduling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 07:55:09 +08:00
Alex Dunmow
b044a6de1a caldav: getctag, sync-collection, scheduling properties and free/busy
Calendar gains CTag (CS:getctag), SyncToken (DAV:sync-token) and
Transparent (CALDAV:schedule-calendar-transp). Three optional Backend
interfaces, checked with type assertions:

- SyncBackend answers the sync-collection REPORT (RFC 6578) and adds
  DAV:supported-report-set to calendars. ErrInvalidSyncToken gives 403
  with DAV:valid-sync-token.
- PrincipalBackend serves calendar-user-address-set, schedule-inbox-URL
  and schedule-outbox-URL on the principal, and the inbox and outbox
  collections themselves (RFC 6638 section 2).
- FreeBusyBackend answers a VFREEBUSY POST to the outbox with a
  schedule-response (RFC 6638 section 10.3), and adds
  calendar-auto-schedule to the DAV header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 07:49:40 +08:00
Alex Dunmow
f9b91e9a35 fork: module path git.dev.alexdunmow.com/blissful/go-webdav
Fork of emersion/go-webdav v0.8.0 for BlissCRM's calendar server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 22:47:46 +08:00
Robin van der Vleuten
2c2af7cdf2 caldav: add Calendar.Color
Read the calendar-color property in the http://apple.com/ns/ical/
namespace in FindCalendar and FindCalendars, and report it in PROPFIND
responses when it is set, the same way as calendar-description.
2026-11-13 14:29:23 +01:00
Robin van der Vleuten
ad1766c2ef
caldav, carddav: fill ReadOnly from current-user-privilege-set in client 2026-11-13 13:54:26 +01:00
Anton Skorochod
1901d193ce caldav, carddav: derive current-user-privilege-set from a read-only flag
The server hard-coded DAV:read + DAV:write in current-user-privilege-set for
every collection (with a TODO). Add a ReadOnly field to Calendar and AddressBook
that the backend sets per request; report DAV:write only when it is false, so
clients (e.g. DAVx5, Apple) correctly mark read-only collections. Default
(false) keeps the previous read-write behavior.
2026-06-25 10:34:50 +02:00
LQR471814
82bb8a7aea caldav: add sync-collection functionality 2025-12-18 14:37:52 +01:00
Jonathan Liu
75c185517e caldav: add expand request to client 2025-03-16 15:41:33 +01:00
Conrad Hoffmann
0456b28ba3 Support setting capabilities in ServePrincipal()
This is done properly in the carddav and caldav packages, but the custom
function does not know what the user intends to serve, so it must be
passed in from the user. Without this, certain clients (e.g. DAVx5)
will be unable to discover endpoints served this way.

Also slightly extend the supported methods returned on OPTIONS requests.
REPORT is properly supported, the others are mostly for not giving
clients the impression that the resources are read-only.
2022-12-13 15:46:51 +01:00
Krystian Chachuła
6f22a649ac caldav: fix validation error when VTIMEZONE is after VEVENT 2022-09-16 09:04:14 +02:00
Conrad Hoffmann
491af8e42c caldav: add support for getcontentlength property
Allow the backend to provide a value for the `getcontentlength` property
as described in [RFC 2518 section 13.4][1].

The implementation treats is as optional, allthough it is a required
property per RFC. Most clients do perfectly fine without it, though.

Properly setting this in the backend makes the CalDAV collection
listable with clients that do require it, e.g. cadaver.

[1]: https://datatracker.ietf.org/doc/html/rfc2518#section-13.4
2022-05-24 10:08:32 +02:00
Conrad Hoffmann
e971269ffb Add function to validate calendar for CalDAV
CalDAV imposes a set of constraints on iCal Calendar objects. They are
spelled out in RFC 4791, section 4.1 [1]. Add an exported function to
validate a calendar according to those constraints, and return data that
is necessary for further CalDAV processing and which can only be
extracted if the calendar meets these constraints.

[1]: https://datatracker.ietf.org/doc/html/rfc4791#section-4.1
2022-05-13 09:20:23 +02:00
Conrad Hoffmann
6887b6b812 Support custom user principal and home set paths
Currently, the user principal path and the home set path are both
hardcoded to "/", for both CalDAV and CardDAV. This poses a challenge if
one wishes to run a CardDAV and CalDAV server in the same server.

This commit introduces the concept of a UserPrincipalBackend. This
backend must provide the path of the current user's principal URL from
the given request context.

The CalDAV and CardDAV backends are extended to also function as
UserPrincipalBackend. In addition, they are required to supply the path
of the respective home set (`calendar-home-set` and
`addressbook-home-set`). The CardDAV and CalDAV servers act accordingly.

The individual servers will continue to work as before (including the
option of keeping everything at "/"). If one wishes to run CardDAV and
CalDAV in parallel, the new `webdav.ServeUserPrincipal()` can be used as
a convenience function to serve a common user principal URL for both
servers. The input for this function can be easily computed by the
application by getting the home set paths from the backends and using
`caldav.NewCalendarHomeSet()` and `carddav.NewAddressbookHomeSet()` to
create the home sets.

Note that the storage backend will have to know about these paths as
well. For any non-trivial use case, a storage backend should probably
have access to the same UserPrincipalBackend. That is, however, an
implementation detail and doesn't have to be reflected in the
interfaces.
2022-05-11 11:12:04 +02:00
Konstantinos Koukas
25dfbaf95e caldav: add supported-calendar-component-set field 2022-04-12 09:38:26 +02:00
Conrad Hoffmann
6401d9ed45 caldav: extend query filter types
The basic types related to queries and filtering are missing some
features specified in the RFC (as also noted in the TODO comments). This
adds several of the missing elements, working towards being able to
handle all RFC-compliant queries.

The work is not fully done, e.g. the collation for text-match is still
not handled, but it's getting pretty close.
2022-04-01 18:29:58 +02:00
Simon Ser
a4e0e81003
caldav: add Client.MultiGetCalendar 2020-05-13 16:45:25 +02:00
Simon Ser
07d4dfae5e
Use new ical library 2020-02-24 17:52:25 +01:00
Simon Ser
1d93353e3d
caldav: add prop-filter support to client 2020-02-05 18:38:46 +01:00
Simon Ser
baf63fb1b7
caldav: parse iCal data 2020-02-05 18:05:48 +01:00
Simon Ser
4eb8396edb
caldav: add support for time filters in client 2020-02-05 17:36:18 +01:00
Simon Ser
ca51e9427a
caldav: add Client.QueryCalendar 2020-02-03 17:26:55 +01:00
Simon Ser
bae7dcce43
caldav: add Client.FindCalendars 2020-01-30 13:51:02 +01:00
Simon Ser
6aea0eda2d
caldav: add Client boilerplate 2020-01-30 13:18:05 +01:00