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

Troy Farrell troy@entheossoft.com
Mon, 17 Mar 2003 13:34:07 -0600


1) html_form:

<form action="pyscript">
   <input type="text" name="username"/>
   <input type="name" name="name"/>
   <input type="text" name="email"/>
   <input type="submit"/>
</form>

2)pyscript:

username = request.has_key('username') and request.username
mapping = {'name': request.has_key('name') and request.name
            ,'email': request.has_key('email') and request.email
            }

# ideally you would do some error checking and input data cleanup.
# someone with permission to execute setAMembersProperties
# might abuse the lack of data checking to change values you don't
# want changed.

container.setAMembersProperties(username, mapping)
request.RESPONSE.redirect('anypage')

Troy

David Bain wrote:
> Okay, so far so good.
> now to integrate a context.REQUEST into the mix, so that I can easily run a 
> through the web version.
> 
> Troy Farrell wrote:
> 
> 
>>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