[Zope] Adding users programatically

Brian Lloyd Brian@digicool.com
Mon, 21 Jun 1999 10:11:06 -0400


> Hi all,
> 
> is there any way to add users to acl_users from within an 
> external method.
> 
> TIA
> 
> Phil

Sure - you can use the _addUser method of the userfolder
object:

  def _addUser(self,name,password,confirm,roles,domains,REQUEST=None):


for example, in an external method, you might do:

  def my_ext_method(self, name, pw):
    """ """
    ret=self.acl_users._addUser(name, pw, pw, ['Some Role'], [])

    # If ret is None, everything worked ok.
    # Otherwise, some error occurred, and ret
    # will be an html message dialog describing
    # the error...
    if ret is not None:
      return ret
    return 'Ok!'


Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com