Commit ed8ede3f authored by Maurits van Rees's avatar Maurits van Rees

Merged r119486 from trunk:

Report success or failure (when known) of creating a new user with
the addzope2user script.
parent a1443e80
...@@ -49,6 +49,9 @@ Bugs Fixed ...@@ -49,6 +49,9 @@ Bugs Fixed
Features Added Features Added
++++++++++++++ ++++++++++++++
- Report success or failure (when known) of creating a new user with
the addzope2user script.
- Moved subset id calculation in `OFS.OrderSupport.moveObjectsByDelta` to a - Moved subset id calculation in `OFS.OrderSupport.moveObjectsByDelta` to a
new helper method, patch by Tom Gross. new helper method, patch by Tom Gross.
......
...@@ -17,7 +17,7 @@ We also need to create a stub user account and login; otherwise we ...@@ -17,7 +17,7 @@ We also need to create a stub user account and login; otherwise we
wouldn't have all the rights to do traversal etc.: wouldn't have all the rights to do traversal etc.:
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
>>> self.login('manager') >>> self.login('manager')
Now for some actual testing... Now for some actual testing...
......
...@@ -55,8 +55,8 @@ Browser pages need to be protected with a permission. Let's test ...@@ -55,8 +55,8 @@ Browser pages need to be protected with a permission. Let's test
those; we start by adding two users: those; we start by adding two users:
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('viewer', 'secret', [], []) >>> _ignored = uf._doAddUser('viewer', 'secret', [], [])
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
>>> protected_view_names = [ >>> protected_view_names = [
... 'eagle.txt', 'falcon.html', 'owl.html', 'flamingo.html', ... 'eagle.txt', 'falcon.html', 'owl.html', 'flamingo.html',
......
...@@ -20,7 +20,7 @@ Set up the test fixtures: ...@@ -20,7 +20,7 @@ Set up the test fixtures:
... glob.glob('%s/*.css' % _prefix))] ... glob.glob('%s/*.css' % _prefix))]
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
Image resource Image resource
......
...@@ -39,7 +39,7 @@ def test_default_view(): ...@@ -39,7 +39,7 @@ def test_default_view():
As a last act of preparation, we create a manager login: As a last act of preparation, we create a manager login:
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
We can specify another default view with browser:defaultView: We can specify another default view with browser:defaultView:
......
...@@ -87,7 +87,7 @@ def test_menu(): ...@@ -87,7 +87,7 @@ def test_menu():
Let's create a manager user account and log in. Let's create a manager user account and log in.
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
>>> self.login('manager') >>> self.login('manager')
>>> newInteraction() >>> newInteraction()
......
...@@ -74,7 +74,7 @@ def test_resource_restricted_code(): ...@@ -74,7 +74,7 @@ def test_resource_restricted_code():
Now let's create a manager user account and log in: Now let's create a manager user account and log in:
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
>>> self.login('manager') >>> self.login('manager')
We can now view them all: We can now view them all:
...@@ -122,7 +122,7 @@ def test_view_restricted_code(): ...@@ -122,7 +122,7 @@ def test_view_restricted_code():
wouldn't have all the rights to do traversal etc.: wouldn't have all the rights to do traversal etc.:
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
>>> self.login('manager') >>> self.login('manager')
>>> protected_view_names = [ >>> protected_view_names = [
......
...@@ -26,7 +26,7 @@ Making a site ...@@ -26,7 +26,7 @@ Making a site
------------- -------------
>>> uf = app.acl_users >>> uf = app.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
Create the test browser we'll be using: Create the test browser we'll be using:
......
...@@ -18,7 +18,7 @@ def test_standard_macros(): ...@@ -18,7 +18,7 @@ def test_standard_macros():
"""Test standard macros """Test standard macros
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
>>> self.login('manager') >>> self.login('manager')
>>> from Products.Five.tests.testing import manage_addFiveTraversableFolder >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
......
...@@ -379,7 +379,7 @@ Before we can begin, we need to set up a few things. We need a ...@@ -379,7 +379,7 @@ Before we can begin, we need to set up a few things. We need a
manager account: manager account:
>>> uf = self.folder.acl_users >>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], []) >>> _ignored = uf._doAddUser('manager', 'r00t', ['Manager'], [])
Finally, we need to setup a traversable folder. Otherwise, Five won't Finally, we need to setup a traversable folder. Otherwise, Five won't
get do its view lookup magic: get do its view lookup magic:
......
...@@ -420,9 +420,10 @@ class ZopeCmd(ZDCmd): ...@@ -420,9 +420,10 @@ class ZopeCmd(ZDCmd):
self.options.python , self.options.python ,
'import Zope2; ' 'import Zope2; '
'app = Zope2.app(); ' 'app = Zope2.app(); '
'app.acl_users._doAddUser(\'%s\', \'%s\', [\'Manager\'], []); ' 'result = app.acl_users._doAddUser(\'%s\', \'%s\', [\'Manager\'], []); '
'import transaction; ' 'import transaction; '
'transaction.commit(); ' 'transaction.commit(); '
'print \'Created user:\', result'
) % (name, password) ) % (name, password)
os.system(cmdline) os.system(cmdline)
......
...@@ -33,7 +33,13 @@ def main(argv=sys.argv): ...@@ -33,7 +33,13 @@ def main(argv=sys.argv):
finder = ZopeFinder(argv) finder = ZopeFinder(argv)
finder.filter_warnings() finder.filter_warnings()
app = finder.get_app() app = finder.get_app()
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."
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment