changeset 4815:d761238f67f9

Groups2009: OpenID related code was refactored to use groups instead of dicts.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Wed, 24 Jun 2009 15:26:05 +0200
parents 26f2648029df
children 7d8f51be2285
files MoinMoin/Page.py MoinMoin/action/serveopenid.py MoinMoin/userprefs/oidserv.py
diffstat 3 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Wed Jun 24 15:26:01 2009 +0200
+++ b/MoinMoin/Page.py	Wed Jun 24 15:26:05 2009 +0200
@@ -1144,12 +1144,9 @@
                         openid_username = self.pi['openid.user']
                         userid = user.getUserId(request, openid_username)
 
-                    if request.cfg.openid_server_restricted_users_group:
-                        request.dicts.addgroup(request,
-                                               request.cfg.openid_server_restricted_users_group)
-
-                    if userid is not None and not request.cfg.openid_server_restricted_users_group or \
-                      request.dicts.has_member(request.cfg.openid_server_restricted_users_group, openid_username):
+                    openid_group_name = request.cfg.openid_server_restricted_users_group
+                    if userid is not None and not openid_group_name or \
+                            (openid_group_name in request.groups and openid_username in request.groups[openid_group_name]):
                         html_head = '<link rel="openid2.provider" href="%s">' % \
                                         wikiutil.escape(request.getQualifiedURL(self.url(request,
                                                                                 querystr={'action': 'serveopenid'})), True)
--- a/MoinMoin/action/serveopenid.py	Wed Jun 24 15:26:01 2009 +0200
+++ b/MoinMoin/action/serveopenid.py	Wed Jun 24 15:26:05 2009 +0200
@@ -141,10 +141,11 @@
 
         # again, we never put an openid.server link on this page...
         # why are they here?
-        if cfg.openid_server_restricted_users_group:
-            request.dicts.addgroup(request, cfg.openid_server_restricted_users_group)
-            if not request.dicts.has_member(cfg.openid_server_restricted_users_group, received_name):
-                return False
+        groups = request.groups
+        openid_group_name = cfg.openid_server_restricted_users_group
+        if openid_group_name and \
+                not (openid_group_name in groups and received_name in groups[openid_group_name]):
+            return False
 
         return True
 
--- a/MoinMoin/userprefs/oidserv.py	Wed Jun 24 15:26:01 2009 +0200
+++ b/MoinMoin/userprefs/oidserv.py	Wed Jun 24 15:26:05 2009 +0200
@@ -26,10 +26,11 @@
         if not self.request.cfg.openid_server_enabled:
             return False
 
-        grp = self.request.cfg.openid_server_restricted_users_group
-        if grp:
-            self.request.dicts.addgroup(self.request, grp)
-            if not self.request.dicts.has_member(grp, self.request.user.name):
+        groups = self.request.groups
+        openid_group_name = self.request.cfg.openid_server_restricted_users_group
+
+        if openid_group_name and \
+            not (openid_group_name in groups and self.request.user.name in groups[openid_group_name]):
                 return False
 
         return True