[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/ - MembershipTool: Support members folder paths to folders deeper in
Jens Vagelpohl
jens at dataflake.org
Sun May 17 08:00:10 EDT 2009
Log message for revision 100023:
- MembershipTool: Support members folder paths to folders deeper in
the portal folder hierarchy by allowing to specify either a
simple name (as before), or a relative path within the portal
in the membership tool "Configuration" ZMI tab.
Changed:
U Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
U Products.CMFDefault/trunk/Products/CMFDefault/MembershipTool.py
U Products.CMFDefault/trunk/Products/CMFDefault/dtml/membershipRolemapping.dtml
U Products.CMFDefault/trunk/Products/CMFDefault/tests/test_MembershipTool.py
-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt 2009-05-17 11:53:24 UTC (rev 100022)
+++ Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt 2009-05-17 12:00:09 UTC (rev 100023)
@@ -4,6 +4,11 @@
2.2.0 (unreleased)
------------------
+- MembershipTool: Support members folder paths to folders deeper in
+ the portal folder hierarchy by allowing to specify either a
+ simple name (as before), or a relative path within the portal
+ in the membership tool "Configuration" ZMI tab.
+
- profiles: Explicitly initialize the workflow manager_bypass value
which has been added to DCWorkflow.
(https://bugs.launchpad.net/zope-cmf/+bug/308947)
Modified: Products.CMFDefault/trunk/Products/CMFDefault/MembershipTool.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/MembershipTool.py 2009-05-17 11:53:24 UTC (rev 100022)
+++ Products.CMFDefault/trunk/Products/CMFDefault/MembershipTool.py 2009-05-17 12:00:09 UTC (rev 100023)
@@ -106,8 +106,11 @@
""" Get the members folder object.
"""
parent = aq_parent( aq_inner(self) )
- members = getattr(parent, self.membersfolder_id, None)
- return members
+ try:
+ members_folder = parent.restrictedTraverse(self.membersfolder_id)
+ except (AttributeError, KeyError):
+ members_folder = None
+ return members_folder
security.declarePublic('createMemberArea')
def createMemberArea(self, member_id=''):
Modified: Products.CMFDefault/trunk/Products/CMFDefault/dtml/membershipRolemapping.dtml
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/dtml/membershipRolemapping.dtml 2009-05-17 11:53:24 UTC (rev 100022)
+++ Products.CMFDefault/trunk/Products/CMFDefault/dtml/membershipRolemapping.dtml 2009-05-17 12:00:09 UTC (rev 100023)
@@ -66,13 +66,14 @@
<h2>Set members folder</h2>
-<p>The members folder has to be in the same container as the membership tool.</p>
+<p>The Members folder path can be a simple name for a folder at the portal
+root, or a relative path to a folder deeper inside the portal.</p>
<form action="manage_setMembersFolderById" method="post">
<table cellspacing="2">
<tr>
<td align="left" valign="top">
- <div class="form-label">Members folder id</div>
+ <div class="form-label">Members folder path</div>
</td>
<td align="left" valign="top">
<input class="form-element" type="text" name="id"
Modified: Products.CMFDefault/trunk/Products/CMFDefault/tests/test_MembershipTool.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/tests/test_MembershipTool.py 2009-05-17 11:53:24 UTC (rev 100022)
+++ Products.CMFDefault/trunk/Products/CMFDefault/tests/test_MembershipTool.py 2009-05-17 12:00:09 UTC (rev 100023)
@@ -56,8 +56,13 @@
self.assertEqual( mtool.getMembersFolder(), None )
self.site._setObject( 'foo', DummyFolder() )
self.assertEqual( mtool.getMembersFolder(), self.site.foo )
+ mtool.setMembersFolderById( id='foo/members' )
+ self.assertEqual( mtool.getMembersFolder(), None )
+ self.site.foo._setObject( 'members', DummyFolder() )
+ self.assertEqual( mtool.getMembersFolder(), self.site.foo.members )
mtool.setMembersFolderById()
- self.assertEqual( mtool.getMembersFolder(), None )
+ # Note: self.site is returned due to DummyObject.restrictedTraverse
+ self.assertEqual( mtool.getMembersFolder(), self.site )
class MembershipToolSecurityTests(SecurityTest):
More information about the Checkins
mailing list