Hi all,

I saw that Hanno added an entry point in Zope2 to create a 
bin/addzope2user command, which does the same as the 'bin/zopectl 
adduser' command.

That got me thinking that I have always found it not very helpful that 
this command never gave feedback about whether the user addition was 
successful or not.  In standard Zope2 it should always work as the 
_doAddUser method in AccessControl simply overwrites an existing user. 
But with Plone or other systems using Products.PluggableAuthService 
nothing is done in this case and the script just stops, giving you no 
clue that it failed.

I propose to add this feedback.  This needs a few simple changes in 
Zope2/utilities, Zope2/Startup, AccessControl, 
Products.PluggableAuthService, and a few doctest fixes in Products.Five. 
  The change to Zope2/utilities/adduser.py would be this:

-    adduser(app, user, pwd)
+    result = adduser(app, user, pwd)
+    if result:
+        print "User %s created." % user
+    else:
+        print "Got no result back. User creation may have failed."
+        print "Maybe the user already exists and nothing is done then."
+        print "Or the implementation does not give info when it succeeds."

The wording leaves room for the current _doAddUser implementations that 
simply never return info.

Is it okay if I do this?

Should/may I backport this to Zope 2.13 and 2.12?

Maurits van Rees
Programmer, Zest Software

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to