[Zope-CMF] Re: allow managers to use setMemberProperties() method

Troy Farrell troy@entheossoft.com
Mon, 17 Mar 2003 12:06:42 -0600


Ok.  Handholding (no assumptions, ok, a few assumptions):
1) Create a file in the Zope/Extensions directory called 'memprop.py'
2) Put the function below in that file
3) Create an external method:

Id: setAMembersProperties
Title: We don't care
Module Name: memprop
Function Name: setAMembersProperties

4) Set pemissions so that only the groups who need it can 'View', 'Take 
ownership', 'Change permissions' and 'Access contents information'
5)Create a python script to call your external method:

username = 'bob'
mapping = {'name': 'Bob Jones'
           ,'email': 'me@yahoo.com'
           }
container.setAMembersProperties(username, mapping)

6) Adjust accordingly.

Troy

David Bain wrote:
> You're going to have to hold my hand a bit with this.
> would these steps be correct.
> 1. create the external method
> 2. call the external method from within a python script / zpt
> 
> with respect to self.portal_membership
> 
> if the information was sent through the REQUEST what would be the equivalent 
> of "self".
> 
> 
> 
> Troy Farrell wrote:
> 
> 
>>I use an external method to accomplish this:
>>
>>def setAMembersProperties(self, uid, props):
>>   """ Set the properties in props (a mapping)
>>   for portal member with id uid.
>>   """
>>
>>   mtool = self.portal_membership
>>   member = mtool.getMemberById(uid)
>>   member.setMemberProperties(props)
>>
>>
>>Make sure you setup the permissions on the External method properly.
>>Otherwise, bad things will happen.  Bad things, man.
>>
>>Troy
>>
>>David Bain wrote:
>>
>>>Is there a workaround that will allow a manager to edit memberdata using
>>>setMemberProperties().
>>>
>>>from my experience and according to the URL below
>>>
> 
> http://cmf.zope.org/design/interfaces/membership/IF_Member/talkback/1010874477/view
> 
>>>it is currently not possible.
>>>
>>>
>>
>>
>>_______________________________________________
>>Zope-CMF maillist  -  Zope-CMF@zope.org
>>http://mail.zope.org/mailman/listinfo/zope-cmf
>>
>>See http://collector.zope.org/CMF for bug reports and feature requests
> 
>