[Checkins] SVN: Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/ Removed too much last time around.

Stefan H. Holek stefan at epy.co.at
Tue Mar 3 09:12:41 EST 2009


Log message for revision 97439:
  Removed too much last time around.

Changed:
  U   Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/PluggableAuthService.py
  U   Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/tests/test_masquerading.py

-=-
Modified: Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/PluggableAuthService.py
===================================================================
--- Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/PluggableAuthService.py	2009-03-03 12:58:44 UTC (rev 97438)
+++ Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/PluggableAuthService.py	2009-03-03 14:12:41 UTC (rev 97439)
@@ -816,6 +816,15 @@
             # plugin enumerators.
             return None
 
+        # Masquerading: Lookup role_user
+        auth_user_id, role_user_id = splitmasq( user_id )
+        if role_user_id is not None:
+            user_id = role_user_id
+
+        auth_user_login, role_user_login = splitmasq( login )
+        if role_user_login is not None:
+            login = role_user_login
+
         criteria = {'exact_match': True}
 
         if user_id is not None:

Modified: Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/tests/test_masquerading.py
===================================================================
--- Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/tests/test_masquerading.py	2009-03-03 12:58:44 UTC (rev 97438)
+++ Products.PluggableAuthService/branches/shh-15-masquerading/Products/PluggableAuthService/tests/test_masquerading.py	2009-03-03 14:12:41 UTC (rev 97439)
@@ -110,6 +110,20 @@
         uids = self.pas._extractUserIds(request, self.pas.plugins)
         self.assertEqual(len(uids), 0)
 
+    def test__verifyUser_by_id(self):
+        info = self.pas._verifyUser(self.pas.plugins, user_id='fred_id/wilma_id')
+        self.assertEqual(info['id'], 'wilma_id')
+        self.assertEqual(info['login'], 'wilma')
+
+    def test__verifyUser_by_login(self):
+        info = self.pas._verifyUser(self.pas.plugins, login='fred/wilma')
+        self.assertEqual(info['id'], 'wilma_id')
+        self.assertEqual(info['login'], 'wilma')
+
+    def test__verifyUser_bad_role_user(self):
+        info = self.pas._verifyUser(self.pas.plugins, login='fred/betty')
+        self.assertEqual(info, None)
+
     def test_validate(self):
         # Rig the request so it looks like we traversed to doc
         request = self.app.REQUEST



More information about the Checkins mailing list