[Zope] Copying users from one instance to another

Jens Vagelpohl jens@zope.com
Fri, 28 Sep 2001 13:51:13 -0400


that sounds like a horrible workaround. what i would do is the following:

- export the old user folder
- import it *into a subfolder* of the new site so it doesn't collide with 
the new site's user folder
- write an external method that manually copies the contents of the old 
site's user folder into the new user folder.

this could look like... (untested)

OLD_UF_PATH = '/path/to/old/acl_users'
NEW_UF_PATH = /acl_users'

def migrateUsers( self ):
     old_uf = self.unrestrictedTraverse( OLD_UF_PATH )
     new_uf = self.unrestrictedTraverse( NEW_UF_PATH )

     old_uf_data = old_uf.data

     for key, value in old_uf_data.items():
         new_uf.data[key] = value

     return 'Done'

jens


On Friday, September 28, 2001, at 11:23 , James Garrison wrote:

> Would this work to copy user definitions from instance A to B?
>
> 1) Export acl_users from A and B to XML files
> 2) Copy user definitions from A's exported file into
>    B's exported file
> 3) Delete acl_users from B and re-import from the updated
>    XML file.
>
> Would the import know enough to adjust object IDs as needed?
> (Is that even a meaningful question? :-)
>
> Jens Vagelpohl wrote:
>>
>> there is no way to achieve this unless you write python code to do that
>> programmatically.
>>
>> jens
>>
>> On Friday, September 28, 2001, at 10:57 , James Garrison wrote:
>>
>>> I'll give this a try.  However, it sounds like this will completely
>>> replace the target instance's user list.  What if I want to take
>>> a set of users from instance A and ADD then to instance B.  Is there
>>> any way to copy users to an existing acl_users folder?
>
> --
> James Garrison                                Athens Group, Inc.
> mailto:jhg@athensgroup.com                    5608 Parkcrest Dr
> http://www.athensgroup.com                    Austin, TX 78731
> PGP: RSA=0x04B73B7F DH/DSS=0x70738D88         (512) 345-0600 x150
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )