[ZPatterns] Patch for LoginManager for 2.4.0...
Steve Spicklemire
[email protected]
Mon, 30 Jul 2001 02:09:23 -0500
This patch adds 'Authenticated' to the roles a user gets from their
UserSource when userRoles is called. This new role is supposed to be
automatically had by all authenticated users. I'm hoping that since
userRoles is only called *after* a successful authentication that it
should be OK to add it unconditionally. If not.. is there a way to tag a
user object to tell that it's been authenticated already? The
BasicUser.py code just checks to make sure the name of the user is not
'Anonymous'. It's not clear that would work here.
-steve
[localhost:~/Zope/pr/LoginManager] steve% diff -c UserSources_orig.py
UserSources.py
*** UserSources_orig.py Mon Jul 30 02:02:16 2001
--- UserSources.py Mon Jul 30 02:05:46 2001
***************
*** 425,431 ****
self.cacheSet(name, 'roles', data)
! return data
def domainsForUser(self, user):
name = user.getUserName()
--- 425,431 ----
self.cacheSet(name, 'roles', data)
! return data + ['Authenticated']
def domainsForUser(self, user):
name = user.getUserName()
***************
*** 553,558 ****
--- 553,559 ----
data = map(lambda x: x.role, data)
elif hasattr(data[0], 'r'):
data = map(lambda x: x.r, data)
+ data = data + ['Authenticated']
except:
data = []
# XXX log exception or something