From 0c823eb312cb59961d49ffce0bf1c6f898bf250a Mon Sep 17 00:00:00 2001 From: Daniel Dourvaris Date: Wed, 1 Jul 2020 12:44:50 +0200 Subject: [PATCH] permissions: explain better what is inactive duplicate in permissions, sort them to last positions, and make them less visible. --- rhodecode/model/db.py | 7 ++++- rhodecode/public/css/tables.less | 6 +++++ .../repo_group_edit_permissions.mako | 26 +++++++++++++------ .../admin/repos/repo_edit_permissions.mako | 14 +++++++--- .../user_groups/user_group_edit_perms.mako | 26 +++++++++++++------ 5 files changed, 58 insertions(+), 21 deletions(-) diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py index 22aa4a12..174a4748 100644 --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -103,7 +103,12 @@ def display_user_sort(obj): if obj.username == User.DEFAULT_USER: return '#####' prefix = PERMISSION_TYPE_SORT.get(obj.permission.split('.')[-1], '') - return prefix + obj.username + extra_sort_num = '1' # default + + # NOTE(dan): inactive duplicates goes last + if getattr(obj, 'duplicate_perm', None): + extra_sort_num = '9' + return prefix + extra_sort_num + obj.username def display_user_group_sort(obj): diff --git a/rhodecode/public/css/tables.less b/rhodecode/public/css/tables.less index ec8b8fed..08326dbd 100644 --- a/rhodecode/public/css/tables.less +++ b/rhodecode/public/css/tables.less @@ -33,6 +33,12 @@ table.dataTable { .rc-user { white-space: nowrap; } + .user-perm-duplicate { + color: @grey4; + a { + color: @grey4; + } + } } .td-email { diff --git a/rhodecode/templates/admin/repo_groups/repo_group_edit_permissions.mako b/rhodecode/templates/admin/repo_groups/repo_group_edit_permissions.mako index b48282d0..78f7717f 100644 --- a/rhodecode/templates/admin/repo_groups/repo_group_edit_permissions.mako +++ b/rhodecode/templates/admin/repo_groups/repo_group_edit_permissions.mako @@ -68,10 +68,15 @@ - ${_('permission for other logged in users')} % endif % else: - ${h.link_to_user(_user.username)} - %if getattr(_user, 'duplicate_perm', None): - (${_('inactive duplicate')}) - %endif + % if getattr(_user, 'duplicate_perm', None): + + ${h.link_to_user(_user.username)} + (${_('inactive duplicate')}) + + + % else: + ${h.link_to_user(_user.username)} + % endif % endif @@ -116,10 +121,15 @@ - ${_('permission for other logged in users')} % endif % else: - ${h.link_to_user(_user.username)} - %if getattr(_user, 'duplicate_perm', None): - (${_('inactive duplicate')}) - %endif + % if getattr(_user, 'duplicate_perm', None): + + ${h.link_to_user(_user.username)} + (${_('inactive duplicate')}) + + + % else: + ${h.link_to_user(_user.username)} + % endif % endif (${_('delegated admin')}) diff --git a/rhodecode/templates/admin/repos/repo_edit_permissions.mako b/rhodecode/templates/admin/repos/repo_edit_permissions.mako index 8a5a1b81..0f5e2879 100644 --- a/rhodecode/templates/admin/repos/repo_edit_permissions.mako +++ b/rhodecode/templates/admin/repos/repo_edit_permissions.mako @@ -94,10 +94,16 @@ - ${_('permission for other logged in users')} % endif % else: - ${h.link_to_user(_user.username)} - %if getattr(_user, 'duplicate_perm', None): - (${_('inactive duplicate')}) - %endif + % if getattr(_user, 'duplicate_perm', None): + + ${h.link_to_user(_user.username)} + (${_('inactive duplicate')}) + + + % else: + ${h.link_to_user(_user.username)} + % endif + %if getattr(_user, 'branch_rules', None): % if used_by_n_rules == 1: (${_('used by {} branch rule, requires write+ permissions').format(used_by_n_rules)}) diff --git a/rhodecode/templates/admin/user_groups/user_group_edit_perms.mako b/rhodecode/templates/admin/user_groups/user_group_edit_perms.mako index e92ad149..a5ff2ce8 100644 --- a/rhodecode/templates/admin/user_groups/user_group_edit_perms.mako +++ b/rhodecode/templates/admin/user_groups/user_group_edit_perms.mako @@ -74,10 +74,15 @@ - ${_('permission for other logged in users')} % endif % else: - ${h.link_to_user(_user.username)} - %if getattr(_user, 'duplicate_perm', None): - (${_('inactive duplicate')}) - %endif + % if getattr(_user, 'duplicate_perm', None): + + ${h.link_to_user(_user.username)} + (${_('inactive duplicate')}) + + + % else: + ${h.link_to_user(_user.username)} + % endif % endif @@ -122,10 +127,15 @@ - ${_('permission for other logged in users')} % endif % else: - ${h.link_to_user(_user.username)} - %if getattr(_user, 'duplicate_perm', None): - (${_('inactive duplicate')}) - %endif + % if getattr(_user, 'duplicate_perm', None): + + ${h.link_to_user(_user.username)} + (${_('inactive duplicate')}) + + + % else: + ${h.link_to_user(_user.username)} + % endif % endif (${_('delegated admin')})