From aa04aa04b76422d8509dd9d313fca5938103850a Mon Sep 17 00:00:00 2001 From: igogold Date: Fri, 4 Mar 2016 11:05:13 +0500 Subject: [PATCH] Fix privilege set for read only collection --- radicale/xmlutils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 05767ce7..0828e871 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -45,7 +45,7 @@ except ImportError: import re import xml.etree.ElementTree as ET -from . import client, config, ical +from . import client, config, ical, rights NAMESPACES = { @@ -300,11 +300,13 @@ def _propfind_response(path, item, props, user): element.append(tag) elif tag == _tag("D", "current-user-privilege-set"): privilege = ET.Element(_tag("D", "privilege")) - privilege.append(ET.Element(_tag("D", "all"))) + if rights.authorized(user, item, "w"): + privilege.append(ET.Element(_tag("D", "all"))) privilege.append(ET.Element(_tag("D", "read"))) - privilege.append(ET.Element(_tag("D", "write"))) - privilege.append(ET.Element(_tag("D", "write-properties"))) - privilege.append(ET.Element(_tag("D", "write-content"))) + if rights.authorized(user, item, "w"): + privilege.append(ET.Element(_tag("D", "write"))) + privilege.append(ET.Element(_tag("D", "write-properties"))) + privilege.append(ET.Element(_tag("D", "write-content"))) element.append(privilege) elif tag == _tag("D", "supported-report-set"): for report_name in (