[Zope-CMF] RE: Zope-CMF digest, Vol 1 #708 - 10 msgs

josh@pdxbands.com josh@pdxbands.com
Fri, 3 Aug 2001 03:12:45 -0700


Marc,

	If I understand this correctly, I would have a folder object that I created
called "user_defaults" at some level, which would contain all the default
objects I would like added to the new users directory upon creation.  So, I
could add a default type of "image" with an id of "myImage" and it will be
placed in the users directory.  Also, any other items I place in there will
be copied into the users directory.

	Is this correct?  If so, where do I place the "user_default" folder object?
It appears that would go in the root of the portal.  Correct?

	Wait, as I read your description I understand to place this script in the
default directory as well.  I guess I need a bit more understanding of where
the objects are and where I can put this.  I think places it in the afteradd
is a better place.  I glanced over the register.dtml and it would be safer
to make this call after the registration is complete.

	If you could give me a slight more help that would be great.  I'd even
write up the how-to if you like.  That would be great for me to learn this
better anyway.

	Sorry for all the questions just starting to understand the layout of CMF
and learn the Python syntax.

Thanks for the help and suggestion.  I can see that this is what I want to
do.  I would like to make a generate entry so I could place this anywhere
and have it managed from the interface.


Regards,

Josh



Message: 5
Date: Thu, 02 Aug 2001 00:21:42 -0400
Subject: Re: [Zope-CMF] how to modify the add user method?
From: marc lindahl <marc@bowery.com>
To: <zope-cmf@zope.org>

I did this, and was going to put together a how-to, haven't had time yet.
But basically, in register.dtml, called this script
(createUserDefaults.pys), which I'll put below.  Modified registered.dtml
also, so that I could print a result string from the function (optional
geekiness).  Also, the .pys had to have a proxy role of owner in order to
work.  Here's the pythonscript (the lines will probably be wrapped in the
wrong place...):

#copy stuff from user_defaults to user folder, build default mypic image
#depends on folder user_defaults with everything there copied
#and an image user_default_mypic both in the same folder as this script
#
uf = container.portal_membership.getHomeFolder(username)

uf.manage_permission('Add Documents, Images, and Files',
['Anonymous','Member', 'Owner','Manager','Reviewer'], 1)
uf.manage_permission('Add portal content', ['Anonymous',
'Member','Owner','Manager','Reviewer'], 1)

obs
=container.user_defaults.manage_copyObjects(container.user_defaults.objectId
s())
uf.manage_pasteObjects(obs)

#uf.mypic.manage_setLocalRoles(username, ['Owner'])

#change this one back, since we're operating in a known, limited situation
uf.manage_permission('Add Documents, Images, and Files', [], 1)
uf.manage_permission('Add portal content', [], 1)

return 'Set up ' + `uf.getId()` +' with default content '+
`container.user_defaults.objectIds()`

> From: <josh@pdxbands.com>
> Date: Wed, 1 Aug 2001 19:59:04 -0700
> To: <dan@control.com>
> Cc: <zope-cmf@zope.org>
> Subject: Re: [Zope-CMF] how to modify the add user method?
>
> 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
>>
>
>
>
>
>
>
>
> _______________________________________________
> 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



--__--__--