[Mpuls-commits] r344 - in wasko/trunk: . waskaweb/lib waskaweb/model waskaweb/templates/administration
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 9 12:42:28 CET 2009
Author: torsten
Date: 2009-03-09 12:42:25 +0100 (Mon, 09 Mar 2009)
New Revision: 344
Modified:
wasko/trunk/ChangeLog.txt
wasko/trunk/waskaweb/lib/helpers.py
wasko/trunk/waskaweb/model/user.py
wasko/trunk/waskaweb/templates/administration/new_user.mako
wasko/trunk/waskaweb/templates/administration/overview_user.mako
Log:
adopted code to changed rolenames
Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt 2009-03-09 11:17:30 UTC (rev 343)
+++ wasko/trunk/ChangeLog.txt 2009-03-09 11:42:25 UTC (rev 344)
@@ -19,6 +19,15 @@
waskaweb/templates/casemanagement/digest_body.mako: Adjusted digest
for WASKO
+
+ Adopted code to changed rolenames (admin_ka -> admin etc.)
+
+ * waskaweb/model/user.py,
+ waskaweb/lib/helpers.py,
+ waskaweb/templates/administration/overview_user.mako,
+ waskaweb/templates/administration/new_user.mako: Adopted code to
+ changed rolenames.
+
2009-03-06 Torsten Irlaender <torsten.irlaender at intevation.de>
Fixed issue79
Modified: wasko/trunk/waskaweb/lib/helpers.py
===================================================================
--- wasko/trunk/waskaweb/lib/helpers.py 2009-03-09 11:17:30 UTC (rev 343)
+++ wasko/trunk/waskaweb/lib/helpers.py 2009-03-09 11:42:25 UTC (rev 344)
@@ -59,7 +59,16 @@
def hasRole(rolelist):
try:
user = session['USER_AUTHORIZED']
- return user.getPermissionRole() in rolelist
+ conv_roles = []
+ for r in rolelist:
+ # Mapping of rolenames. The old rolenames are used all over the
+ # application. So change them here.
+ if r == 'cm_ka': conv_roles.append('cm')
+ elif r == 'admin_ka': conv_roles.append('admin')
+ elif r == 'pb_ka': conv_roles.append('pb')
+ else: conv_roles.append(r)
+ user_role = user.getPermissionRole()
+ return user_role in conv_roles
except KeyError:
return False
Modified: wasko/trunk/waskaweb/model/user.py
===================================================================
--- wasko/trunk/waskaweb/model/user.py 2009-03-09 11:17:30 UTC (rev 343)
+++ wasko/trunk/waskaweb/model/user.py 2009-03-09 11:42:25 UTC (rev 344)
@@ -264,30 +264,30 @@
def getPermissionRole(self):
'''Returns the users permissionrole
Available rolenames:
- * admin_ka
- * cm_ka
- * pt_dlr
+ * admin
+ * cm
+ * pt
'''
try:
tok = self.role.split('_')
- return "_".join(tok[-2:])
+ return "_".join(tok[-1:])
except:
return None
def getRole(self):
'''Returns the string of the users role which is meant to be displayed in the ui
Translate Roles:
- * admin_ka -> Admin-KA
- * cm_ka -> CM-KA
- * pt_dlr -> PT-DLR
+ * admin -> Admin
+ * cm -> CM
+ * pt -> PT
'''
permrole = self.getPermissionRole()
- if permrole == 'cm_ka':
- return 'CM-KA'
- elif permrole == 'admin_ka':
- return 'Admin-KA'
- elif permrole == 'pt_dlr':
- return 'PT-DLR'
+ if permrole == 'cm':
+ return 'CM'
+ elif permrole == 'admin':
+ return 'Admin'
+ elif permrole == 'pt':
+ return 'PT'
else:
return permrole
@@ -339,7 +339,7 @@
User.__init__(self, 0)
self.last_name = 'Zentrale Administration'
self.needs_passrefresh = False
- self.role = 'ka_%s_admin_ka' % getDbName()
+ self.role = 'ka_%s_admin' % getDbName()
self.full_login = lname
tok = lname.split('_')
self.login = "_".join(tok[2:])
Modified: wasko/trunk/waskaweb/templates/administration/new_user.mako
===================================================================
--- wasko/trunk/waskaweb/templates/administration/new_user.mako 2009-03-09 11:17:30 UTC (rev 343)
+++ wasko/trunk/waskaweb/templates/administration/new_user.mako 2009-03-09 11:42:25 UTC (rev 344)
@@ -83,19 +83,19 @@
% if h.getLogin() != 'adm':
<select name="role" id="role">
% if c.isEvaluationServer:
- <option value="PB-KA">PB-Ka</option>
+ <option value="PB">PB</option>
% else:
- <option value="CM-KA" >CM-Ka</option>
+ <option value="CM" >CM</option>
% endif
- <option value="Admin-KA">Admin-Ka</option>
+ <option value="Admin">Admin</option>
</select>
% else:
% if c.isEvaluationServer:
- PB-KA
- <input type="hidden" name="role" value="PB-KA">
- % else:
- Admin-KA
- <input type="hidden" name="role" value="Admin-KA">
+ PB
+ <input type="hidden" name="role" value="PB">
+ % else:
+ Admin
+ <input type="hidden" name="role" value="Admin">
% endif
% endif
</div>
Modified: wasko/trunk/waskaweb/templates/administration/overview_user.mako
===================================================================
--- wasko/trunk/waskaweb/templates/administration/overview_user.mako 2009-03-09 11:17:30 UTC (rev 343)
+++ wasko/trunk/waskaweb/templates/administration/overview_user.mako 2009-03-09 11:42:25 UTC (rev 344)
@@ -34,7 +34,7 @@
<tr>
<td>${user.last_name| F.NA, h}</td>
<td>${user.first_name| F.NA, h}</td>
- % if user.getRole() == 'Admin-KA':
+ % if user.getRole() == 'Admin':
<td><img src="/images/icons/admin_grey_tag.gif" alt="Administratorin, Administrator" title="Administrator/in"></td>
% else:
<td><img src="/images/icons/cm_grey_tag_width.gif" alt="Case-Managerin, Case-Manager" title="Case-Manager/in"></td>
More information about the Mpuls-commits
mailing list