Merge pull request #363 from igogold/readonly-collections

Fix privilege set for read only collection
This commit is contained in:
Guillaume Ayoub 2016-03-31 19:23:47 +02:00
commit f27ed8e6ff

View File

@ -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 (