[Mpuls-commits] r889 - wasko/branches/2.0/waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 26 15:11:41 CET 2010


Author: torsten
Date: 2010-01-26 15:11:40 +0100 (Tue, 26 Jan 2010)
New Revision: 889

Modified:
   wasko/branches/2.0/waskaweb/lib/helpers.py
Log:
* waskaweb/lib/helpers.py (hasRole): Moved dic with mapping of old and
new rolenames into hasRole function. The dic is not used anywhere


Modified: wasko/branches/2.0/waskaweb/lib/helpers.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/helpers.py	2010-01-26 14:05:57 UTC (rev 888)
+++ wasko/branches/2.0/waskaweb/lib/helpers.py	2010-01-26 14:11:40 UTC (rev 889)
@@ -51,22 +51,19 @@
 log = logging.getLogger(__name__)
 
 
-# map old role names to the newer non-application-specific names
-_old_role_names = {
-    'cm_ka': 'cm',
-    'admin_ka': 'admin',
-    'pb_ka': 'pb',
-    }
-
 def hasRole(rolelist):
-    # TODO: move to separate security library
+    old_role_names = {
+        'cm_ka': 'cm',
+        'admin_ka': 'admin',
+        'pb_ka': 'pb',
+        }
     try:
         user = session['USER_AUTHORIZED']
         conv_roles = []
         for r in rolelist:
             # Mapping of rolenames. The old rolenames are used all over the
             # application. So change them here.
-            conv_roles.append(_old_role_names.get(r, r))
+            conv_roles.append(old_role_names.get(r, r))
         user_role = user.getPermissionRole()
         return user_role in conv_roles
     except KeyError:



More information about the Mpuls-commits mailing list