[Zope] merging the contents of two acl_users folders

David H bluepaul at earthlink.net
Thu Jun 23 19:19:48 EDT 2005


Jim,
Alright, I found the way to get needed user information in order to 
merge (create users in a dest folder).

You need an external script.  Otherwise you will not be able to access 
acl_users _getPassword().  Local scripts enforce this for security reasons.

So here is the external script that you can modify to your needs

#----------------------------------------
#Zope/Extensions/getUserData.py
# just pass in the *source* acl_users folder
#----------------------------------------
def getUserData(self,acl_users):

   users = acl_users.getUsers()
 
   dict = {}
   for user in users:
      dict[user.getId()] = {'name' : user.getUserName(), 'password' : 
user._getPassword(), 'roles' : user.getRoles() }
   return dict

Then call this with a local python script:

request = context.REQUEST
users = container.getPasswords(acl_users)
for k in users:
  user = users[k]
  print k,user['password'],user['name'],user['roles']  # to test
 
Hope this helps you reach the "tipping point"  if you've not already 
gotten there.

David


> Jim,
>
> David H didn't think thru his answer.   I do not think you can acquire 
> *passwords* the way I indicated. If so my suggestion will not work.  
> The approach will work otherwise.
>
> Maybe someone  that knows about this will pitch in.  I'm reviewing 
> User.py now...
>
> David
> . 
>
>
> David H wrote:
>
>>/Jim,
>>
>>It can be done, eg
>>
>> loop thru source.acl_users
>>   for each user object
>>     stuff REQUEST with name,password,confirm (password again) and roles, eg
>>     REQUEST.set('name',username), etc
>>//     context.Destination.acl_users.manage_users('Add',REQUEST,RESPONSE)//
>>
>>
>>David
>>
>>/
>>
>>
>> Jim Abramson wrote:
>>
>>> Can it be done? (programmically obtain data from one acl_users 
>>> folder and merge into another)
>>>
>>> If not that, the ability to move selected users from one acl_users 
>>> to another would be a decent plan B.
>>>
>>> This is a one-time move, so I consider any effective solution 
>>> viable, even if some manual hacking is involved.
>>>
>>> Thanks for any help,
>>> Jim
>>>
>>>
>>
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050623/ff24c748/attachment.htm


More information about the Zope mailing list