Changeset - 6cc17e42fa49
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 12 years ago 2013-05-28 15:52:24
marcin@python-works.com
Don't show empty permissions for users, only for admins
3 files changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/templates/admin/permissions/permissions.html
Show inline comments
 
@@ -132,13 +132,13 @@
 
    <div class="title">
 
        <h5>${_('Default User Permissions')}</h5>
 
    </div>
 

	
 
    ## 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">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Allowed IP addresses')}</h5>
rhodecode/templates/admin/users/user_edit.html
Show inline comments
 
@@ -151,13 +151,13 @@
 
    </div>
 
    <%namespace name="dpb" file="/base/default_perms_box.html"/>
 
    ${dpb.default_perms_box(url('user_perm', id=c.user.user_id))}
 

	
 
    ## 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">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Email addresses')}</h5>
rhodecode/templates/base/perms_summary.html
Show inline comments
 
## snippet for displaying permissions overview for users
 
## usage:
 
##    <%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>
 
        %if not permissions[section]:
 
            <span class="empty_data">${_('No permissions defined yet')}</span>
 
        %else:
 
        <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
 
         <table id="tbl_list_${section}">
 
          ## global permission box
 
          %if section == 'global':
 
              <thead>
 
                  <tr>
 
                  <th colspan="2" class="left">${_('Permission')}</th>
 
                  <th class="left">${_('Edit Permission')}</th>
 
              </thead>
 
@@ -36,12 +37,13 @@
 
                  <th class="left">${_('Name')}</th>
 
                  <th class="left">${_('Permission')}</th>
 
                  <th class="left">${_('Edit Permission')}</th>
 
              </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':
 
                              <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
 
                          %elif section == 'repositories_groups':
 
                              <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
 
@@ -60,12 +62,13 @@
 
                              <a href="${h.url('edit_repos_group',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
 
                          %elif section == 'user_groups':
 
                              ##<a href="${h.url('edit_users_group',id=k)}">${_('edit')}</a>
 
                          %endif
 
                      </td>
 
                  </tr>
 
                  %endif
 
              %endfor
 
              </tbody>
 
          %endif
 
         </table>
 
        </div>
 
        %endif
0 comments (0 inline, 0 general)