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
Chetan Kumar writes:
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 ? You write an External Method (in order to be able to read the file in the file system. An (more difficult) alternative would be to upload the file into Zope and work with a Python script).
The External Method reads the file (line by line), parses it and calls the RegistrationTools join method, i.e. it emulates the registration form and calls the registration action. Details for your homework... Dieter
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 )
participants (3)
-
Chetan Kumar -
Dieter Maurer -
Mark Gibson