Commit Graph

25 Commits

Author SHA1 Message Date
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
Simon Ser
abadf534f4
carddav: expose supported address data in client 2020-02-27 12:36:14 +01:00
Simon Ser
5f03e421d3
carddav: fix addressbook-home-set>href namespace 2020-01-29 17:41:28 +01:00
Simon Ser
73b67b62b1
carddav: add client support for query filter
References: https://github.com/emersion/go-webdav/issues/18
2020-01-24 12:24:35 +01:00
Simon Ser
5ada08f6ab
carddav: add full query AST 2020-01-24 11:25:58 +01:00
Simon Ser
e56ab47c43
carddav: add negateCondition 2020-01-23 19:32:10 +01:00
Simon Ser
30977aac83
carddav: add matchType 2020-01-23 19:27:31 +01:00
Simon Ser
38b729ad9c
carddav: remove filter.MarshalText
This isn't necessary, we can just straight up let encoding/xml use the
string.
2020-01-23 19:21:00 +01:00
Simon Ser
70c3bffdf3
carddav: add filter and limit XML definitions 2020-01-22 20:36:35 +01:00
Simon Ser
cd5945aace
carddav: add AddressBook{Query,MultiGet}.AllProp 2020-01-22 19:18:58 +01:00
Simon Ser
7e29f37bd8
carddav: add allprop and propname support to query and multiget in server 2020-01-22 18:59:01 +01:00
Simon Ser
6eeeccb96e
all: encode hrefs, replace hrefs with path in public API
Closes: https://github.com/emersion/go-webdav/issues/14
Closes: https://github.com/emersion/go-webdav/issues/16
2020-01-22 11:07:30 +01:00
Simon Ser
6e0ea58de1
carddav: populate AddressBook.{Name,MaxResourceSize} in client 2020-01-19 15:29:51 +01:00
Simon Ser
c4718a3a49
carddav: add addressbook-home-set to server 2020-01-19 15:10:54 +01:00
Simon Ser
6bac674701
carddav: add max-resource-size to serve 2020-01-19 15:06:09 +01:00
Simon Ser
238e72b73e
carddav: add addressbook-supprted-address-data to server 2020-01-19 15:00:40 +01:00
Simon Ser
edfc2804b5
carddav: add displayname and addressbook-description to server 2020-01-19 14:53:58 +01:00
Simon Ser
797b2f8fc5
carddav: add address-data to server responses 2020-01-19 12:08:53 +01:00
Simon Ser
60e5d57cda
carddav: implement REPORT addressbook-multiget 2020-01-19 11:05:56 +01:00
Simon Ser
402593c5c6
carddav: define XML names as globals 2020-01-18 12:58:53 +01:00
Simon Ser
34b2ebf940
all: use variables for xml.Name values 2020-01-17 17:09:23 +01:00
Simon Ser
2b841a9234
carddav: add support for <addressbook-multiget> 2020-01-15 12:09:42 +01:00
Simon Ser
56c162197b
carddav: add Client.QueryAddressBook 2020-01-14 23:44:21 +01:00
Simon Ser
9dfabd89c8
carddav: add Client.FindAddressBooks 2020-01-14 23:13:23 +01:00
Simon Ser
3d05533a31
carddav: add very basic Client 2020-01-14 22:19:54 +01:00