Monotone-Parent: d8678bc76a58d190f4f7fc03f138123104dfb577

Monotone-Revision: e44f8ed7f2cb0a7509257497630e18c476b9b901

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-09-20T13:42:16
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-09-20 13:42:16 +00:00
parent b2f882a898
commit d9cf3145da
3 changed files with 38 additions and 13 deletions

View File

@ -1,3 +1,16 @@
2010-09-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tests/Integration/test-davacl.py
(DAVCalendarPublicAclTest.testCollectionAccessNormalUser): make
use of the fix below when removing the rights for the subscriber
user.
* Tests/Integration/utilities.py (TestACLUtility.setupRights):
when "rights" is None or unspecified, the user is now deleted from
the access list. This enable default roles to take place for the
specified user, which is different from simply removing all its
rights.
2010-09-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Main/SOGo+DAV.m (-davComplianceClassesInContext:): new method to

View File

@ -1014,7 +1014,7 @@ class DAVCalendarPublicAclTest(unittest.TestCase):
"href was returned more than once: %s" % href.text)
resourceHrefs[href.text] = True
acl_utility.setupRights(subscriber_username, {})
acl_utility.setupRights(subscriber_username)
# 3. creation right added for "default user"
# subscriber_username expected to have access, but not "anonymous"

View File

@ -64,22 +64,34 @@ class TestACLUtility(TestUtility):
def rightsToSOGoRights(self, rights):
self.fail("subclass must implement this method")
def setupRights(self, username, rights):
rights_str = "".join(["<%s/>"
% x for x in self.rightsToSOGoRights(rights) ])
aclQuery = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<acl-query"
+ " xmlns=\"urn:inverse:params:xml:ns:inverse-dav\">"
+ "<set-roles user=\"%s\">%s</set-roles>" % (xml.sax.saxutils.escape(username),
rights_str)
+ "</acl-query>")
def setupRights(self, username, rights = None):
if rights is not None:
rights_str = "".join(["<%s/>"
% x for x in self.rightsToSOGoRights(rights) ])
aclQuery = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<acl-query"
+ " xmlns=\"urn:inverse:params:xml:ns:inverse-dav\">"
+ "<set-roles user=\"%s\">%s</set-roles>" % (xml.sax.saxutils.escape(username),
rights_str)
+ "</acl-query>")
else:
aclQuery = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<acl-query"
+ " xmlns=\"urn:inverse:params:xml:ns:inverse-dav\">"
+ "<remove-user user=\"%s\"/>" % xml.sax.saxutils.escape(username)
+ "</acl-query>")
post = webdavlib.HTTPPOST(self.resource, aclQuery)
post.content_type = "application/xml; charset=\"utf-8\""
self.client.execute(post)
self.test.assertEquals(post.response["status"], 204,
"rights modification: failure to set '%s' (status: %d)"
% (rights_str, post.response["status"]))
if rights is None:
err_msg = ("rights modification: failure to remove entry (status: %d)"
% post.response["status"])
else:
err_msg = ("rights modification: failure to set '%s' (status: %d)"
% (rights_str, post.response["status"]))
self.test.assertEquals(post.response["status"], 204, err_msg)
# Calendar:
# rights: