[Zope-CMF] Re: [CMF-checkins] CVS: CMF/CMFDefault - MembershipTool.py:1.35.2.1

Florent Guillaume fg@nuxeo.com
Mon, 23 Jun 2003 17:48:19 +0200


> Log Message:
> changed member area creation:
> - made logged_in page instead of wrapUser call 'createMemberarea'
> - made MembershipTool folderish to store skeleton content inside
> - added a hook to 'createMemberarea' to customize member content creation
> - adjusted tests
> 
> === CMF/CMFDefault/MembershipTool.py 1.35 => 1.35.2.1 ===
> --- CMF/CMFDefault/MembershipTool.py:1.35	Wed May 28 07:52:16 2003
> +++ CMF/CMFDefault/MembershipTool.py	Thu May 29 10:39:58 2003
[...]
> +        if not members:
> +            return None
> +        if self.isAnonymousUser():
> +            return None
> +        # Note: We can't use getAuthenticatedMember() and getMemberById()
> +        # because they might be wrapped by MemberDataTool.

Why is that a problem ?

[...]
> +        # Note: We can't use invokeFactory() to add folder and content because
> +        # the user might not have the necessary permissions.
> +
> +        # Create Member's home folder.
> +        members.manage_addPortalFolder(id=member_id,
> +                                       title="%s's Home" % member_id)
> +        f = getattr(members, member_id)

It would be nice if the portal type of the folder was customizable too.
And properly in the workflows. I know I need this for CPS. This would
need modified TypesTool methods that can create content without the
security checks -- I plan to do this at some point.

>              # Grant Ownership and Owner role to Member
> -            f.index_html.changeOwnership(user)
> +            f.index_html.changeOwnership(member)
>              f.index_html.__ac_local_roles__ = None
>              f.index_html.manage_setLocalRoles(member_id, ['Owner'])
>  
>              f.index_html._setPortalTypeName( 'Document' )
> -
> -            # Overcome an apparent catalog bug.
>              f.index_html.reindexObject()
> -            wftool = getToolByName( f, 'portal_workflow' )
> -            wftool.notifyCreated( f.index_html )
> +            f.index_html.notifyWorkflowCreated()

God this is ugly, we shouldn't have to do TypesTool's work here either.
I hope I can work on it.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com