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

Chris McDonough chrism@zope.com
Wed, 16 Oct 2002 17:15:12 -0400


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

Modified Files:
	User.py 
Log Message:
Fix up calls to user objects' getUserName which should really be calls to 
getId.  This is a change designed to make it possible to disambiguate user names and user ids in subclasses of user folders, while still doing the "right thing" with respect to local data structures that keep pointers to user ids (eg. local roles, etc.)


=== Zope/lib/python/AccessControl/User.py 1.171 => 1.172 ===
--- Zope/lib/python/AccessControl/User.py:1.171	Thu Sep 26 09:56:21 2002
+++ Zope/lib/python/AccessControl/User.py	Wed Oct 16 17:14:41 2002
@@ -85,7 +85,7 @@
         """Return the list of roles assigned to the user,
            including local roles assigned in context of
            the passed in object."""
-        name=self.getUserName()
+        userid=self.getId()
         roles=self.getRoles()
         local={}
         object=getattr(object, 'aq_inner', object)
@@ -95,7 +95,7 @@
                 if callable(local_roles):
                     local_roles=local_roles()
                 dict=local_roles or {}
-                for r in dict.get(name, []):
+                for r in dict.get(userid, []):
                     local[r]=1
             inner = getattr(object, 'aq_inner', object)
             parent = getattr(inner, 'aq_parent', None)
@@ -207,14 +207,14 @@
         # this manually rather than call getRolesInContext so that
         # we can incur only the overhead required to find a match.
         inner_obj = getattr(object, 'aq_inner', object)
-        user_name = self.getUserName()
+        userid = self.getId()
         while 1:
             local_roles = getattr(inner_obj, '__ac_local_roles__', None)
             if local_roles:
                 if callable(local_roles):
                     local_roles = local_roles()
                 dict = local_roles or {}
-                local_roles = dict.get(user_name, [])
+                local_roles = dict.get(userid, [])
                 for role in object_roles:
                     if role in local_roles:
                         if self._check_context(object):