[ZDP] faq addition

Rik Hoekstra hoekstra@fsw.LeidenUniv.nl
Tue, 22 Jun 1999 08:52:10 +0200

Wanting this for a long time myself, but never having got around to it,
today I saw the answer to a question in the Zope list. I once proposed that
someone would monitor the lists for answers to questions that might be
useful for the faq. Now I guess I am taking up this task...


* Is there any way to add users to acl_users from within an external method?

  You can use the _addUser method of the userfolder object, i.e.

  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!'