[Zope-Checkins] CVS: Zope/lib/python/AccessControl - User.py:1.179

Chris McDonough chrism@zope.com
Sat, 26 Jul 2003 17:58:53 -0400


Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv29718/AccessControl

Modified Files:
	User.py 
Log Message:
Provide a newbie-friendly message about adding users at the top of the
quickstart page if the root acl_users contains no users.  Required an
additional default user folder method, hasUsers.


=== Zope/lib/python/AccessControl/User.py 1.178 => 1.179 ===
--- Zope/lib/python/AccessControl/User.py:1.178	Thu Jul 10 01:04:26 2003
+++ Zope/lib/python/AccessControl/User.py	Sat Jul 26 17:58:18 2003
@@ -1026,6 +1026,14 @@
         """Return the named user object or None"""
         return self.data.get(name, None)
 
+    def hasUsers(self):
+        """ This is not a formal API method: it is used only to provide
+        a way for the quickstart page to determine if the default user
+        folder contains any users to provide instructions on how to
+        add a user for newbies.  Using getUserNames or getUsers would have
+        posed a denial of service risk."""
+        return not not len(self.data)
+
     def _doAddUser(self, name, password, roles, domains, **kw):
         """Create a new user"""
         if password is not None and self.encrypt_passwords: