changeset 4888:2d5c306b51df

Added auth_attribs for users who log in with OpenID SREG. Fixed call to create teams in OpenID extension.
author Rowan Kerr <rowan@stasis.org>
date Tue, 26 May 2009 17:35:11 -0400
parents 16e584c1dd59
children 6279b8badd5f
files MoinMoin/auth/openidrp.py MoinMoin/auth/openidrp_ext/openidrp_sreg.py MoinMoin/auth/openidrp_ext/openidrp_teams.py
diffstat 3 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/auth/openidrp.py	Tue May 26 16:59:03 2009 -0400
+++ b/MoinMoin/auth/openidrp.py	Tue May 26 17:35:11 2009 -0400
@@ -24,6 +24,7 @@
     login_inputs = ['openid_identifier']
     name = 'openid'
     logout_possible = True
+    auth_attribs = ()
 
     def __init__(self, modify_request=None,
                        update_user=None,
@@ -44,7 +45,8 @@
         if create:
             # pass in a created but unsaved user object
             u = user.User(request, auth_method=self.name,
-                          auth_username=request.session['openid.id'])
+                          auth_username=request.session['openid.id'],
+                          auth_attribs=self.auth_attribs)
             # invalid name
             u.name = ''
             u = self._create_user(request.session['openid.info'], u, request.cfg)
@@ -143,11 +145,6 @@
             query[key] = request.values.get(key)
         current_url = get_multistage_continuation_url(request, self.name,
                                                       {'oidstage': '1'})
-                                                      # 'janrain_nonce': request.values.get('janrain_nonce')})
-        # Because the order of dict keys cannot be guaranteed, this last param must
-        # be appended in string form to make sure order of URL prams matches
-        # between current_url and the OpenID return_to value.
-        #current_url += u'&' + url_encode({'janrain_nonce': request.values.get('janrain_nonce')})
         info = oidconsumer.complete(query, current_url)
         if info.status == consumer.FAILURE:
             logging.debug(_("OpenID error: %s.") % info.message)
@@ -164,7 +161,8 @@
             uid = user.getUserIdByOpenId(request, info.identity_url)
             if uid:
                 u = user.User(request, id=uid, auth_method=self.name,
-                              auth_username=info.identity_url)
+                              auth_username=info.identity_url,
+                              auth_attribs=self.auth_attribs)
             else:
                 u = None
 
@@ -198,7 +196,8 @@
         if not uid:
             # we can create a new user with this name :)
             u = user.User(request, auth_method=self.name,
-                          auth_username=request.session['openid.id'])
+                          auth_username=request.session['openid.id'],
+                          auth_attribs=self.auth_attribs)
             u.name = newname
             u = self._handle_user_data(request, u)
             return ContinueLogin(u)
@@ -218,7 +217,8 @@
             return self._handle_name_continuation(request)
         u = user.User(request, name=username, password=password,
                       auth_method=self.name,
-                      auth_username=request.session['openid.id'])
+                      auth_username=request.session['openid.id'],
+                      auth_attribs=self.auth_attribs)
         if u.valid:
             self._handle_user_data(request, u)
             return ContinueLogin(u, _('Your account is now associated to your OpenID.'))
--- a/MoinMoin/auth/openidrp_ext/openidrp_sreg.py	Tue May 26 16:59:03 2009 -0400
+++ b/MoinMoin/auth/openidrp_ext/openidrp_sreg.py	Tue May 26 17:35:11 2009 -0400
@@ -29,7 +29,7 @@
 #    logout_possible = True
 #    auth_attribs = ['name', 'email', 'aliasname', 'language', 'tz_offset']
 
-OpenIDAuth.auth_attribs = ['name', 'email', 'aliasname', 'language', 'tz_offset']
+OpenIDAuth.auth_attribs = ('name', 'email', 'aliasname', 'language', 'tz_offset')
 
 def openidrp_sreg_modify_request(oidreq, cfg):
     oidreq.addExtension(SRegRequest(required=cfg.openidrp_sreg_required,
--- a/MoinMoin/auth/openidrp_ext/openidrp_teams.py	Tue May 26 16:59:03 2009 -0400
+++ b/MoinMoin/auth/openidrp_ext/openidrp_teams.py	Tue May 26 17:35:11 2009 -0400
@@ -48,7 +48,7 @@
     teams_response = TeamsResponse.fromSuccessResponse(info)
     teams = teams_response.is_member
     if teams:
-        _save_teams_acl(u, teams)
+        _save_teams_acl(u, teams, cfg)
     return u
 
 def openidrp_teams_update_user(info, u, cfg):