From fe1cd1d44dd9bdf380dd7eca5c2588b959a3e9b9 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Thu, 24 Oct 2013 15:31:49 +0200 Subject: [PATCH 1/2] Use collection URL instead of main folder as user's main URL (see #32) --- radicale/xmlutils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 72c193c1..a0ecdad7 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -296,7 +296,10 @@ def _propfind_response(path, item, props, user): # pylint: enable=W0511 elif tag == _tag("D", "current-user-principal") and user: tag = ET.Element(_tag("D", "href")) - tag.text = _href("/%s/" % user) + if item.resource_type == "addressbook": + tag.text = _href("/%s/addressbook.vcf/" % user) + else: + tag.text = _href("/%s/calendar.ics/" % user) element.append(tag) elif tag == _tag("D", "current-user-privilege-set"): privilege = ET.Element(_tag("D", "privilege")) From ce8e86af630a97254f7be929ea5ee1ea31b8e074 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Thu, 31 Oct 2013 13:57:37 +0100 Subject: [PATCH 2/2] Allow read-only access to .well-known/ca(l|rd)av (related to #32) --- radicale/rights.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/radicale/rights.py b/radicale/rights.py index 7f741a14..335ef06b 100644 --- a/radicale/rights.py +++ b/radicale/rights.py @@ -95,6 +95,10 @@ def authorized(user, collection, right): If the user is empty it checks for anonymous rights """ + collection_url = collection.url.rstrip("/") or "/" + if collection_url in (".well-known/carddav", ".well-known/caldav"): + return right == "r" rights_type = config.get("rights", "type").lower() - return rights_type == "none" or (_read_from_sections( - user or "", collection.url.rstrip("/") or "/", right)) + return ( + rights_type == "none" or + _read_from_sections(user or "", collection_url, right))