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

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


Author: torsten
Date: 2010-01-26 15:23:38 +0100 (Tue, 26 Jan 2010)
New Revision: 894

Modified:
   wasko/branches/2.0/waskaweb/lib/helpers.py
Log:
* waskaweb/lib/helpers.py: Import hasRole from lib.security



Modified: wasko/branches/2.0/waskaweb/lib/helpers.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/helpers.py	2010-01-26 14:19:26 UTC (rev 893)
+++ wasko/branches/2.0/waskaweb/lib/helpers.py	2010-01-26 14:23:38 UTC (rev 894)
@@ -44,31 +44,13 @@
 
 from waskaweb.lib.filecache import FileCache
 from waskaweb.lib.navigation import get_pagename, render_navigation
+from waskaweb.lib.security import hasRole 
 
 
 PRINTABLE = frozenset(printable)
 
 log = logging.getLogger(__name__)
 
-
-def hasRole(rolelist):
-    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))
-        user_role = user.getPermissionRole()
-        return user_role in conv_roles
-    except KeyError:
-        return False
-
 def getRole():
     try:
         user = session['USER_AUTHORIZED']



More information about the Mpuls-commits mailing list