permissions: fixed missing user info on global and repository permissions pages.

This commit is contained in:
Daniel Dourvaris 2020-07-01 12:57:48 +02:00
parent 0c823eb312
commit 94a30540f9
4 changed files with 31 additions and 11 deletions

View file

@ -960,7 +960,7 @@ def link_to_user(author, length=0, **kwargs):
if length:
display_person = shorter(display_person, length)
if user:
if user and user.username != user.DEFAULT_USER:
return link_to(
escape(display_person),
route_path('user_profile', username=user.username),

View file

@ -243,7 +243,9 @@
<div class="${_class}">
${self.gravatar(email, size, tooltip=tooltip, tooltip_alt=contact, user=rc_user)}
<span class="${('user user-disabled' if show_disabled else 'user')}"> ${h.link_to_user(rc_user or contact)}</span>
<span class="${('user user-disabled' if show_disabled else 'user')}">
${h.link_to_user(rc_user or contact)}
</span>
</div>
</%def>

View file

@ -3,6 +3,7 @@
## <%namespace name="dpb" file="/base/default_perms_box.mako"/>
## ${dpb.default_perms_box(<url_to_form>)}
## ${dpb.default_perms_radios()}
<%namespace name="base" file="/base/base.mako"/>
<%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)">
<div class="main-content-full-width">
@ -11,10 +12,22 @@
## displayed according to checkbox selection
<div class="panel-heading">
%if not global_permissions_template:
<h3 class="inherit_overlay_default panel-title">${_('Inherited Permissions')}</h3>
<h3 class="inherit_overlay panel-title">${_('Custom Permissions')}</h3>
<h3 class="inherit_overlay_default panel-title">
% if hasattr(c, 'user'):
${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} &nbsp;-
% endif
${_('Inherited Permissions')}
</h3>
<h3 class="inherit_overlay panel-title">
% if hasattr(c, 'user'):
${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} &nbsp;-
% endif
${_('Custom Permissions')}
</h3>
%else:
<h3 class="panel-title">${_('Default Global Permissions')}</h3>
<h3 class="panel-title">
${_('Default Global Permissions')}
</h3>
%endif
</div>

View file

@ -2,14 +2,15 @@
## usage:
## <%namespace name="p" file="/base/perms_summary.mako"/>
## ${p.perms_summary(c.perm_user.permissions)}
<%namespace name="base" file="/base/base.mako"/>
<%def name="perms_summary(permissions, show_all=False, actions=True, side_link=None)">
<% section_to_label = {
'global': 'Global Permissions',
'repository_branches': 'Repository Branch Rules',
'repositories': 'Repository Access Permissions',
'user_groups': 'User Group Permissions',
'repositories_groups': 'Repository Group Permissions',
'global': 'Global Permissions Summary',
'repository_branches': 'Repository Branch Rules Summary',
'repositories': 'Repository Access Permissions Summary',
'user_groups': 'User Group Permissions Summary',
'repositories_groups': 'Repository Group Permissions Summary',
} %>
<div id="perms" class="table fields">
@ -18,7 +19,11 @@
<div class="panel panel-default">
<div class="panel-heading" id="${section.replace("_","-")}-permissions">
<h3 class="panel-title">${section_to_label.get(section, section)} - <span id="total_count_${section}"></span>
<h3 class="panel-title">
% if hasattr(c, 'user'):
${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} &nbsp;-
% endif
${section_to_label.get(section, section)} - <span id="total_count_${section}"></span>
<a class="permalink" href="#${section.replace("_","-")}-permissions"> ¶</a>
</h3>
% if side_link: