changeset 3901:6cc17e42fa49 beta

Don't show empty permissions for users, only for admins
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 28 May 2013 15:52:24 +0200
parents 10eb03eabfb7
children 056827d78073
files rhodecode/templates/admin/permissions/permissions.html rhodecode/templates/admin/users/user_edit.html rhodecode/templates/base/perms_summary.html
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/templates/admin/permissions/permissions.html	Sat May 25 15:38:57 2013 +0200
+++ b/rhodecode/templates/admin/permissions/permissions.html	Tue May 28 15:52:24 2013 +0200
@@ -135,7 +135,7 @@
 
     ## permissions overview
     <%namespace name="p" file="/base/perms_summary.html"/>
-    ${p.perms_summary(c.perm_user.permissions)}
+    ${p.perms_summary(c.perm_user.permissions, show_all=True)}
 
 </div>
 <div class="box box-left" style="clear:left">
--- a/rhodecode/templates/admin/users/user_edit.html	Sat May 25 15:38:57 2013 +0200
+++ b/rhodecode/templates/admin/users/user_edit.html	Tue May 28 15:52:24 2013 +0200
@@ -154,7 +154,7 @@
 
     ## permissions overview
     <%namespace name="p" file="/base/perms_summary.html"/>
-    ${p.perms_summary(c.perm_user.permissions)}
+    ${p.perms_summary(c.perm_user.permissions, show_all=True)}
 
 </div>
 <div class="box box-left" style="clear:left">
--- a/rhodecode/templates/base/perms_summary.html	Sat May 25 15:38:57 2013 +0200
+++ b/rhodecode/templates/base/perms_summary.html	Tue May 28 15:52:24 2013 +0200
@@ -3,7 +3,7 @@
 ##    <%namespace name="p" file="/base/perms_summary.html"/>
 ##    ${p.perms_summary(c.perm_user.permissions)}
 
-<%def name="perms_summary(permissions)">
+<%def name="perms_summary(permissions, show_all=False)">
 <div id="perms" class="table">
      %for section in sorted(permissions.keys()):
         <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
@@ -12,6 +12,7 @@
         %else:
         <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
          <table id="tbl_list_${section}">
+          ## global permission box
           %if section == 'global':
               <thead>
                   <tr>
@@ -39,6 +40,7 @@
               </thead>
               <tbody>
               %for k, section_perm in sorted(permissions[section].items(), key=lambda s: s[1]+s[0].lower()):
+                  %if section_perm.split('.')[-1] != 'none' or show_all:
                   <tr>
                       <td>
                           %if section == 'repositories':
@@ -63,6 +65,7 @@
                           %endif
                       </td>
                   </tr>
+                  %endif
               %endfor
               </tbody>
           %endif