[CMF-checkins] CVS: CMF - MembershipTool.py:1.9
Jens Vagelpohl
jens@digicool.com
Fri, 8 Jun 2001 15:29:50 -0400 (EDT)
Update of /cvs-repository/CMF/CMFCore
In directory korak.digicool.com:/tmp/cvs-serv20417/CMFCore
Modified Files:
MembershipTool.py
Log Message:
Changes to the Membership tools in CMFCore and CMFDefault to stamp out the differences
between automatic membership area creation as used if you have an existing member source
(external user folder) as opposed of people who join using the standard registration
mechanism.
The previous incarnation had the problem of not creating index_html for automatically created
member areas because i did not want to introduce a dependency from CMFCore (Membership Tool)
to CMFDefault (Document class used for index_html). (see also PTK Tracker issue 308)
By overriding createMemberarea in CMFDefault's Membership Tool i was able to create the
document and thus replicate exactly what the addMember method in CMFDefault does. I moved all
logic to create the folder, fiddle with roles and ownership and create the doc into
createMemberarea now and the addMember method is calling createMemberarea after
invoking CMFCore.MembershipTool's addMember
--- Updated File MembershipTool.py in package CMF --
--- MembershipTool.py 2001/06/04 02:35:28 1.8
+++ MembershipTool.py 2001/06/08 19:29:49 1.9
@@ -298,6 +298,17 @@
f.manage_permission(CMFCorePermissions.AccessContentsInformation,
['Owner','Manager','Reviewer'], 0)
+ member = self.getMemberById(member_id)
+ if hasattr(getattr(member, 'aq_base', member), 'getUser'):
+ user = member.getUser()
+ else:
+ user = member
+
+ # Grant ownership to Member
+ try: f.changeOwnership(user)
+ except AttributeError: pass # Zope 2.1.x compatibility
+ f.manage_setLocalRoles(member_id, ['Owner'])
+
security.declarePublic('isAnonymousUser')
def isAnonymousUser(self):