[Zope-CMF] how to modify the add user method?

josh@pdxbands.com josh@pdxbands.com
Wed, 1 Aug 2001 19:59:04 -0700


Dan,

	This would be a great idea.  That is, add in a module or class I can modify
to customize the ending effects.  I think the afteradd is a great way to
achieve this as I would like to add a default image and folder to the users
home directory that will have them as the owner.  I believe that will happen
if I make the call to create an object in the afteradd.  Is that correct?

	Does your code that you have in the afteradd achieve this?  If so could you
give me a sample as I'm new to python and Zope.

Thanks.

Josh


Message: 4
Date: Wed, 01 Aug 2001 11:19:10 -0400
From: "Dan L. Pierson" <dan@control.com>
To: "zope-cmf@zope.org" <zope-cmf@zope.org>
Subject: Re: [Zope-CMF] how to modify the add user method?



--On Wednesday, August 01, 2001 07:56:59 AM -0400 Jens Vagelpohl
<jens@zope.com> wrote:

> - create your own Membership Tool by subclassing from
> CMFDefault/MembershipTool.py - implement addMember in your new membership
> tool class with all the modifications you want - replace the default
> membership tool in the CMF with your own
>
> that's the "clean and correct" way of doing it. for a code example look
> at these files:
>
> http://cvs.dataflake.org:8080/CMFLDAP/

There are two other hooks that may make this easier and, IMHO, just as
clean and correct:

1. If all you need to add is additional member properties, the standard
addMember processing calls member.setMemberProperties with *all* the
properties from the registration form.  The default MemberDataTool turns
this into a call on MemberData.setMemberProperties (via a path I don't
remember) which filters them to the properties declared in the
MemberDataTool.

This means that if you are using the default membership support you can
define additional member properties by adding them to portal_memberdata's
Properties tab and the registration form.

If you are not using the default membership support you can make your
member object (e.g. ZClass) implement setMemberProperties (this is what
we do for LoginManager based members).

2. The last thing RegistrationTool.addMember does is call
RegistrationTool.afterAdd.  This means that you can subclass
CMFCore.RegistrationTool and define your own afterAdd method.
We have one which simply calls a PythonScript skin method named
new_member_actions to do any additional member processing.
IMHO, this would be a good standard feature for a future CMF.

>
> jens
>
> On Wednesday, August 1, 2001, at 04:44 , <josh@pdxbands.com> wrote:
>
>> Looking for a way to modify the add user call. I would like to be able
>> to  do
>> some additional features at the time a user is created.
>>
>> Which file do I need to modify?  Or, can I just put an external method
>> call
>> when a user is created?
>>
>> Thanks.
>>
>> Josh
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
> requests
>