##// END OF EJS Templates
branch-rules forbid removal of permissions assigned.
marcink -
r2977:239b4827 default
parent child Browse files
Show More
@@ -1952,6 +1952,10 b' class Repository(Base, BaseModel):'
1952 1952 # if this user is also owner/admin, mark as duplicate record
1953 1953 if usr.user_id == owner_row[0].user_id or usr.user_id in super_admin_ids:
1954 1954 usr.duplicate_perm = True
1955 # also check if this permission is maybe used by branch_permissions
1956 if _usr.branch_perm_entry:
1957 usr.branch_rules = [x.branch_rule_id for x in _usr.branch_perm_entry]
1958
1955 1959 usr.permission = _usr.permission.permission_name
1956 1960 usr.permission_id = _usr.repo_to_perm_id
1957 1961 perm_rows.append(usr)
@@ -74,11 +74,19 b''
74 74 %if getattr(_user, 'duplicate_perm', None):
75 75 (${_('inactive duplicate')})
76 76 %endif
77 %if getattr(_user, 'branch_rules', None):
78 <% used_by_n_rules = len(_user.branch_rules) %>
79 % if used_by_n_rules == 1:
80 (${_('used by {} branch rule').format(used_by_n_rules)})
81 % else:
82 (${_('used by {} branch rules').format(used_by_n_rules)})
83 % endif
84 %endif
77 85 % endif
78 86 </span>
79 87 </td>
80 88 <td class="td-action">
81 %if _user.username != h.DEFAULT_USER:
89 %if _user.username != h.DEFAULT_USER and getattr(_user, 'branch_rules', None) is None:
82 90 <span class="btn btn-link btn-danger revoke_perm"
83 91 member="${_user.user_id}" member_type="user">
84 92 ${_('Revoke')}
General Comments 0
You need to be logged in to leave comments. Login now