[Zope-Checkins] CVS: Zope2 - User.py:1.150

chrism@serenade.digicool.com chrism@serenade.digicool.com
Mon, 21 May 2001 13:57:12 -0400


Update of /cvs-repository/Zope2/lib/python/AccessControl
In directory serenade:/home/chrism/sandboxes/PostRegexTrunk/lib/python/AccessControl

Modified Files:
	User.py 
Log Message:
Add 'Authenticated' role as a standard Zope role.  The Authenticated role is provided to those users who have succesfully authenticated to Zope in any manner (basically, all users who are not the Anonymous User) by default.



--- Updated File User.py in package Zope2 --
--- User.py	2001/04/27 20:27:37	1.149
+++ User.py	2001/05/21 17:57:12	1.150
@@ -249,6 +249,12 @@
         if object_roles is None or 'Anonymous' in object_roles:
             return 1
 
+        # Provide short-cut access if object is protected by 'Authenticated'
+        # role and user is not nobody
+        if 'Authenticated' in object_roles and (
+            self.getUserName() != 'Anonymous User'):
+            return 1
+
         # Check for ancient role data up front, convert if found.
         # This should almost never happen, and should probably be
         # deprecated at some point.
@@ -343,7 +349,8 @@
 
     def getRoles(self):
         """Return the list of roles assigned to a user."""
-        return tuple(self.roles)
+        if self.name == 'Anonymous User': return tuple(self.roles)
+        else: return tuple(self.roles) + ('Authenticated',)
 
     def getDomains(self):
         """Return the list of domain restrictions for a user"""