[Zope] Adding Members en mass

Mark Gibson mark@dimensional.com
Mon, 12 Aug 2002 14:34:12 -0600


I've used an external method to parse users from a space delmited file 
and load them into the zodb.  You'll need to add domains and whatever 
else you need to the call to manage_users.  Adjust as needed....

---------

import string


def addAuthUsers(self, REQUEST, infile='/tmp/auth.txt'):
    """
     import users from infile, a space delimited file...
    """
    #output - just used to let me know who got imported.
    output=open('/tmp/userout.txt','w')
    infile=open( infile ,'r')
    output.write('opened %s\n'%infile)
    for line in infile.readlines():
       line=string.strip(line)
       (name,password)=string.split(line,' ')
       try:
          self.acl_users.manage_users(submit='Add',REQUEST={
 
'name':name,'password':password,'confirm':password,'roles':['member',]}) 
         output.write("added user name=%s, password=%s\n"%(name,password))
       except:
          output.write("couldn't add user name=%s, 
password=%s\n"%(name,password))



---------

Chetan Kumar wrote:

> Hi all
> I want to add LARGE number of members to my CMF site in one shot.
> The necessary dettils like login, password, domains and roles should
> be put in a file all the members should appear in the acl_users.
> What is the best way of doing this ?
> I am not looking at the possibility of adding this to a SQL DB about
> which I have no doubts.
> TIA.
> Regards,
> Chetan
> 
> 
> _______________________________________________
> 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 )