Show More
The requested changes are too big and content was truncated. Show full diff
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
@@ -1,72 +1,73 b'' | |||||
1 | // # Copyright (C) 2010-2018 RhodeCode GmbH |
|
1 | // # Copyright (C) 2010-2018 RhodeCode GmbH | |
2 | // # |
|
2 | // # | |
3 | // # This program is free software: you can redistribute it and/or modify |
|
3 | // # This program is free software: you can redistribute it and/or modify | |
4 | // # it under the terms of the GNU Affero General Public License, version 3 |
|
4 | // # it under the terms of the GNU Affero General Public License, version 3 | |
5 | // # (only), as published by the Free Software Foundation. |
|
5 | // # (only), as published by the Free Software Foundation. | |
6 | // # |
|
6 | // # | |
7 | // # This program is distributed in the hope that it will be useful, |
|
7 | // # This program is distributed in the hope that it will be useful, | |
8 | // # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
8 | // # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
9 | // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | // # GNU General Public License for more details. |
|
10 | // # GNU General Public License for more details. | |
11 | // # |
|
11 | // # | |
12 | // # You should have received a copy of the GNU Affero General Public License |
|
12 | // # You should have received a copy of the GNU Affero General Public License | |
13 | // # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | // # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 | // # |
|
14 | // # | |
15 | // # This program is dual-licensed. If you wish to learn more about the |
|
15 | // # This program is dual-licensed. If you wish to learn more about the | |
16 | // # RhodeCode Enterprise Edition, including its added features, Support services, |
|
16 | // # RhodeCode Enterprise Edition, including its added features, Support services, | |
17 | // # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
17 | // # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
18 |
|
18 | |||
19 | // creates new permission input box with autocomplete |
|
19 | // creates new permission input box with autocomplete | |
20 | var addNewPermInput = function(node, permission_type, cur_used_id){ |
|
20 | var addNewPermInput = function(node, permission_type, cur_used_id){ | |
21 | var _html = '<tr class="new_members" id="add_perm_input_{0}">'+ |
|
21 | var _html = '<tr class="new_members" id="add_perm_input_{0}">'+ | |
22 | '<td class="td-radio"><input type="radio" value="{1}.none" name="perm_new_member_perm_{0}"></td>'+ |
|
22 | '<td class="td-radio"><input type="radio" value="{1}.none" name="perm_new_member_perm_{0}"></td>'+ | |
23 | '<td class="td-radio"><input type="radio" value="{1}.read" name="perm_new_member_perm_{0}" checked="checked"></td>'+ |
|
23 | '<td class="td-radio"><input type="radio" value="{1}.read" name="perm_new_member_perm_{0}" checked="checked"></td>'+ | |
24 | '<td class="td-radio"><input type="radio" value="{1}.write" name="perm_new_member_perm_{0}"></td>'+ |
|
24 | '<td class="td-radio"><input type="radio" value="{1}.write" name="perm_new_member_perm_{0}"></td>'+ | |
25 | '<td class="td-radio"><input type="radio" value="{1}.admin" name="perm_new_member_perm_{0}"></td>'+ |
|
25 | '<td class="td-radio"><input type="radio" value="{1}.admin" name="perm_new_member_perm_{0}"></td>'+ | |
26 | '<td class="ac">'+ |
|
26 | '<td class="ac">'+ | |
27 | ' <div class="perm_ac" id="perm_ac_{0}">'+ |
|
27 | ' <div class="perm_ac" id="perm_ac_{0}">'+ | |
28 | ' <input class="ac-input" id="perm_new_member_name_{0}" name="perm_new_member_name_{0}" value="" type="text" autocomplete="off">'+ |
|
28 | ' <input class="ac-input" id="perm_new_member_name_{0}" name="perm_new_member_name_{0}" value="" type="text" autocomplete="off">'+ | |
29 | ' <input type="hidden" id="perm_new_member_id_{0}" name="perm_new_member_id_{0}" value="">'+ |
|
29 | ' <input type="hidden" id="perm_new_member_id_{0}" name="perm_new_member_id_{0}" value="">'+ | |
30 | ' <input type="hidden" id="perm_new_member_type_{0}" name="perm_new_member_type_{0}" value="">'+ |
|
30 | ' <input type="hidden" id="perm_new_member_type_{0}" name="perm_new_member_type_{0}" value="">'+ | |
31 | ' <div id="perm_container_{0}"></div>'+ |
|
31 | ' <div id="perm_container_{0}"></div>'+ | |
32 | ' </div>'+ |
|
32 | ' </div>'+ | |
33 | '</td>'+ |
|
33 | '</td>'+ | |
34 | '<td></td>'+ |
|
34 | '<td></td>'+ | |
|
35 | '<td></td>'+ | |||
35 | '</tr>'; |
|
36 | '</tr>'; | |
36 | var _next_id = 'new'+$('.new_members').length; |
|
37 | var _next_id = 'new'+$('.new_members').length; | |
37 | _html = _html.format(_next_id, permission_type); |
|
38 | _html = _html.format(_next_id, permission_type); | |
38 | $('#add_perm_input').before(_html); |
|
39 | $('#add_perm_input').before(_html); | |
39 |
|
40 | |||
40 | //autocomplete widget |
|
41 | //autocomplete widget | |
41 | $('#perm_new_member_name_{0}'.format(_next_id)).autocomplete({ |
|
42 | $('#perm_new_member_name_{0}'.format(_next_id)).autocomplete({ | |
42 | serviceUrl: pyroutes.url('user_autocomplete_data'), |
|
43 | serviceUrl: pyroutes.url('user_autocomplete_data'), | |
43 | minChars:2, |
|
44 | minChars:2, | |
44 | maxHeight:400, |
|
45 | maxHeight:400, | |
45 | width:300, |
|
46 | width:300, | |
46 | deferRequestBy: 300, //miliseconds |
|
47 | deferRequestBy: 300, //miliseconds | |
47 | showNoSuggestionNotice: true, |
|
48 | showNoSuggestionNotice: true, | |
48 | params: { user_id: cur_used_id, user_groups:true }, |
|
49 | params: { user_id: cur_used_id, user_groups:true }, | |
49 | formatResult: autocompleteFormatResult, |
|
50 | formatResult: autocompleteFormatResult, | |
50 | lookupFilter: autocompleteFilterResult, |
|
51 | lookupFilter: autocompleteFilterResult, | |
51 | onSelect: function(element, suggestion){ |
|
52 | onSelect: function(element, suggestion){ | |
52 | $('#perm_new_member_id_{0}'.format(_next_id)).val(suggestion['id']); |
|
53 | $('#perm_new_member_id_{0}'.format(_next_id)).val(suggestion['id']); | |
53 | $('#perm_new_member_type_{0}'.format(_next_id)).val(suggestion['value_type']); |
|
54 | $('#perm_new_member_type_{0}'.format(_next_id)).val(suggestion['value_type']); | |
54 | } |
|
55 | } | |
55 | }); |
|
56 | }); | |
56 |
|
57 | |||
57 | }; |
|
58 | }; | |
58 |
|
59 | |||
59 | // marks current input for "revoke" action |
|
60 | // marks current input for "revoke" action | |
60 | var markRevokePermInput = function(node, permission_type){ |
|
61 | var markRevokePermInput = function(node, permission_type){ | |
61 | var obj_type = $(node).attr('member_type'); |
|
62 | var obj_type = $(node).attr('member_type'); | |
62 | var obj_id = $(node).attr('member'); |
|
63 | var obj_id = $(node).attr('member'); | |
63 | var tr = $(node).parent().parent(); |
|
64 | var tr = $(node).parent().parent(); | |
64 |
|
65 | |||
65 | if(!tr.hasClass('to-delete')){ |
|
66 | if(!tr.hasClass('to-delete')){ | |
66 | tr.css({"text-decoration":"line-through", "opacity": 0.5}); |
|
67 | tr.css({"text-decoration":"line-through", "opacity": 0.5}); | |
67 | tr.addClass('to-delete'); |
|
68 | tr.addClass('to-delete'); | |
68 | // inject special hidden input that we mark the user for deletion |
|
69 | // inject special hidden input that we mark the user for deletion | |
69 | tr.append($('<input type="hidden" name="perm_del_member_id_{0}" value="{1}"/>'.format(obj_id, obj_id))); |
|
70 | tr.append($('<input type="hidden" name="perm_del_member_id_{0}" value="{1}"/>'.format(obj_id, obj_id))); | |
70 | tr.append($('<input type="hidden" name="perm_del_member_type_{0}" value="{1}"/>'.format(obj_id, obj_type))); |
|
71 | tr.append($('<input type="hidden" name="perm_del_member_type_{0}" value="{1}"/>'.format(obj_id, obj_type))); | |
71 | } |
|
72 | } | |
72 | }; |
|
73 | }; |
@@ -1,156 +1,189 b'' | |||||
1 | <%namespace name="base" file="/base/base.mako"/> |
|
1 | <%namespace name="base" file="/base/base.mako"/> | |
2 |
|
2 | |||
3 | <div class="panel panel-default"> |
|
3 | <div class="panel panel-default"> | |
4 | <div class="panel-heading"> |
|
4 | <div class="panel-heading"> | |
5 | <h3 class="panel-title">${_('Repository Group Permissions')}</h3> |
|
5 | <h3 class="panel-title">${_('Repository Group Permissions')}</h3> | |
6 | </div> |
|
6 | </div> | |
7 | <div class="panel-body"> |
|
7 | <div class="panel-body"> | |
8 | ${h.secure_form(h.route_path('edit_repo_group_perms_update', repo_group_name=c.repo_group.group_name), request=request)} |
|
8 | ${h.secure_form(h.route_path('edit_repo_group_perms_update', repo_group_name=c.repo_group.group_name), request=request)} | |
9 | <table id="permissions_manage" class="rctable permissions"> |
|
9 | <table id="permissions_manage" class="rctable permissions"> | |
10 | <tr> |
|
10 | <tr> | |
11 | <th class="td-radio">${_('None')}</th> |
|
11 | <th class="td-radio">${_('None')}</th> | |
12 | <th class="td-radio">${_('Read')}</th> |
|
12 | <th class="td-radio">${_('Read')}</th> | |
13 | <th class="td-radio">${_('Write')}</th> |
|
13 | <th class="td-radio">${_('Write')}</th> | |
14 | <th class="td-radio">${_('Admin')}</th> |
|
14 | <th class="td-radio">${_('Admin')}</th> | |
15 | <th class="td-owner">${_('User/User Group')}</th> |
|
15 | <th class="td-owner">${_('User/User Group')}</th> | |
16 | <th></th> |
|
16 | <th></th> | |
|
17 | <th></th> | |||
17 | </tr> |
|
18 | </tr> | |
18 | ## USERS |
|
19 | ## USERS | |
19 | %for _user in c.repo_group.permissions(): |
|
20 | %for _user in c.repo_group.permissions(): | |
|
21 | ## super admin/owner row | |||
20 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): |
|
22 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): | |
21 | <tr class="perm_admin_row"> |
|
23 | <tr class="perm_admin_row"> | |
22 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> |
|
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> | |
23 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td> |
|
25 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td> | |
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td> |
|
26 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td> | |
25 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td> |
|
27 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td> | |
26 | <td class="td-user"> |
|
28 | <td class="td-user"> | |
27 | ${base.gravatar(_user.email, 16)} |
|
29 | ${base.gravatar(_user.email, 16)} | |
28 | ${h.link_to_user(_user.username)} |
|
30 | ${h.link_to_user(_user.username)} | |
29 | %if getattr(_user, 'admin_row', None): |
|
31 | %if getattr(_user, 'admin_row', None): | |
30 | (${_('super admin')}) |
|
32 | (${_('super admin')}) | |
31 | %endif |
|
33 | %endif | |
32 | %if getattr(_user, 'owner_row', None): |
|
34 | %if getattr(_user, 'owner_row', None): | |
33 | (${_('owner')}) |
|
35 | (${_('owner')}) | |
34 | %endif |
|
36 | %endif | |
35 | </td> |
|
37 | </td> | |
36 | <td></td> |
|
38 | <td></td> | |
|
39 | <td> | |||
|
40 | % if c.rhodecode_user.is_admin: | |||
|
41 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
42 | % endif | |||
|
43 | </td> | |||
37 | </tr> |
|
44 | </tr> | |
38 | %else: |
|
45 | %else: | |
39 | <tr> |
|
46 | <tr> | |
40 | ##forbid revoking permission from yourself, except if you're an super admin |
|
47 | ##forbid revoking permission from yourself, except if you're an super admin | |
41 | %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin: |
|
48 | %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin: | |
42 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', checked=_user.permission=='group.none')}</td> |
|
49 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', checked=_user.permission=='group.none')}</td> | |
43 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', checked=_user.permission=='group.read')}</td> |
|
50 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', checked=_user.permission=='group.read')}</td> | |
44 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', checked=_user.permission=='group.write')}</td> |
|
51 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', checked=_user.permission=='group.write')}</td> | |
45 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin', checked=_user.permission=='group.admin')}</td> |
|
52 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin', checked=_user.permission=='group.admin')}</td> | |
46 | <td class="td-user"> |
|
53 | <td class="td-user"> | |
47 | ${base.gravatar(_user.email, 16)} |
|
54 | ${base.gravatar(_user.email, 16)} | |
48 | <span class="user"> |
|
55 | <span class="user"> | |
49 | % if _user.username == h.DEFAULT_USER: |
|
56 | % if _user.username == h.DEFAULT_USER: | |
50 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
57 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
51 | % else: |
|
58 | % else: | |
52 | ${h.link_to_user(_user.username)} |
|
59 | ${h.link_to_user(_user.username)} | |
|
60 | %if getattr(_user, 'duplicate_perm', None): | |||
|
61 | (${_('inactive duplicate')}) | |||
|
62 | %endif | |||
53 | % endif |
|
63 | % endif | |
54 | </span> |
|
64 | </span> | |
55 | </td> |
|
65 | </td> | |
56 | <td class="td-action"> |
|
66 | <td class="td-action"> | |
57 | %if _user.username != h.DEFAULT_USER: |
|
67 | %if _user.username != h.DEFAULT_USER: | |
58 | <span class="btn btn-link btn-danger revoke_perm" |
|
68 | <span class="btn btn-link btn-danger revoke_perm" | |
59 | member="${_user.user_id}" member_type="user"> |
|
69 | member="${_user.user_id}" member_type="user"> | |
60 | ${_('Revoke')} |
|
70 | ${_('Revoke')} | |
61 | </span> |
|
71 | </span> | |
62 | %endif |
|
72 | %endif | |
63 | </td> |
|
73 | </td> | |
|
74 | <td> | |||
|
75 | % if c.rhodecode_user.is_admin: | |||
|
76 | % if _user.username == h.DEFAULT_USER: | |||
|
77 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
|
78 | % else: | |||
|
79 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
80 | % endif | |||
|
81 | % endif | |||
|
82 | </td> | |||
64 | %else: |
|
83 | %else: | |
65 | ## special case for current user permissions, we make sure he cannot take his own permissions |
|
84 | ## special case for currently logged-in user permissions, we make sure he cannot take his own permissions | |
66 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', disabled="disabled")}</td> |
|
85 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', disabled="disabled")}</td> | |
67 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', disabled="disabled")}</td> |
|
86 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', disabled="disabled")}</td> | |
68 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', disabled="disabled")}</td> |
|
87 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', disabled="disabled")}</td> | |
69 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin', disabled="disabled")}</td> |
|
88 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin', disabled="disabled")}</td> | |
70 | <td class="td-user"> |
|
89 | <td class="td-user"> | |
71 | ${base.gravatar(_user.email, 16)} |
|
90 | ${base.gravatar(_user.email, 16)} | |
72 | <span class="user"> |
|
91 | <span class="user"> | |
73 | % if _user.username == h.DEFAULT_USER: |
|
92 | % if _user.username == h.DEFAULT_USER: | |
74 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
93 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
75 | % else: |
|
94 | % else: | |
76 | ${h.link_to_user(_user.username)} |
|
95 | ${h.link_to_user(_user.username)} | |
|
96 | %if getattr(_user, 'duplicate_perm', None): | |||
|
97 | (${_('inactive duplicate')}) | |||
|
98 | %endif | |||
77 | % endif |
|
99 | % endif | |
78 | <span class="user-perm-help-text">(${_('delegated admin')})</span> |
|
100 | <span class="user-perm-help-text">(${_('delegated admin')})</span> | |
79 | </span> |
|
101 | </span> | |
80 | </td> |
|
102 | </td> | |
81 | <td></td> |
|
103 | <td></td> | |
|
104 | <td> | |||
|
105 | % if c.rhodecode_user.is_admin: | |||
|
106 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
107 | % endif | |||
|
108 | </td> | |||
82 | %endif |
|
109 | %endif | |
83 | </tr> |
|
110 | </tr> | |
84 | %endif |
|
111 | %endif | |
85 | %endfor |
|
112 | %endfor | |
86 |
|
113 | |||
87 | ## USER GROUPS |
|
114 | ## USER GROUPS | |
88 | %for _user_group in c.repo_group.permission_user_groups(): |
|
115 | %for _user_group in c.repo_group.permission_user_groups(): | |
89 | <tr id="id${id(_user_group.users_group_name)}"> |
|
116 | <tr id="id${id(_user_group.users_group_name)}"> | |
90 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.none', checked=_user_group.permission=='group.none')}</td> |
|
117 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.none', checked=_user_group.permission=='group.none')}</td> | |
91 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.read', checked=_user_group.permission=='group.read')}</td> |
|
118 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.read', checked=_user_group.permission=='group.read')}</td> | |
92 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.write', checked=_user_group.permission=='group.write')}</td> |
|
119 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.write', checked=_user_group.permission=='group.write')}</td> | |
93 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.admin', checked=_user_group.permission=='group.admin')}</td> |
|
120 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.admin', checked=_user_group.permission=='group.admin')}</td> | |
94 | <td class="td-componentname"> |
|
121 | <td class="td-componentname"> | |
95 | <i class="icon-user-group"></i> |
|
122 | <i class="icon-user-group"></i> | |
96 | %if h.HasPermissionAny('hg.admin')(): |
|
123 | %if h.HasPermissionAny('hg.admin')(): | |
97 | <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}"> |
|
124 | <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}"> | |
98 | ${_user_group.users_group_name} |
|
125 | ${_user_group.users_group_name} | |
99 | </a> |
|
126 | </a> | |
100 | %else: |
|
127 | %else: | |
101 | ${h.link_to_group(_user_group.users_group_name)} |
|
128 | ${h.link_to_group(_user_group.users_group_name)} | |
102 | %endif |
|
129 | %endif | |
103 | </td> |
|
130 | </td> | |
104 | <td class="td-action"> |
|
131 | <td class="td-action"> | |
105 | <span class="btn btn-link btn-danger revoke_perm" |
|
132 | <span class="btn btn-link btn-danger revoke_perm" | |
106 | member="${_user_group.users_group_id}" member_type="user_group"> |
|
133 | member="${_user_group.users_group_id}" member_type="user_group"> | |
107 | ${_('Revoke')} |
|
134 | ${_('Revoke')} | |
108 | </span> |
|
135 | </span> | |
109 | </td> |
|
136 | </td> | |
|
137 | <td> | |||
|
138 | % if c.rhodecode_user.is_admin: | |||
|
139 | ${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))} | |||
|
140 | % endif | |||
|
141 | </td> | |||
110 | </tr> |
|
142 | </tr> | |
111 | %endfor |
|
143 | %endfor | |
112 |
|
144 | |||
113 | <tr class="new_members" id="add_perm_input"></tr> |
|
145 | <tr class="new_members" id="add_perm_input"></tr> | |
114 | <tr> |
|
146 | <tr> | |
115 | <td></td> |
|
147 | <td></td> | |
116 | <td></td> |
|
148 | <td></td> | |
117 | <td></td> |
|
149 | <td></td> | |
118 | <td></td> |
|
150 | <td></td> | |
119 | <td></td> |
|
151 | <td></td> | |
120 | <td> |
|
152 | <td> | |
121 | <span id="add_perm" class="link"> |
|
153 | <span id="add_perm" class="link"> | |
122 | ${_('Add user/user group')} |
|
154 | ${_('Add user/user group')} | |
123 | </span> |
|
155 | </span> | |
124 | </td> |
|
156 | </td> | |
|
157 | <td></td> | |||
125 | </tr> |
|
158 | </tr> | |
126 | </table> |
|
159 | </table> | |
127 |
|
160 | |||
128 | <div class="fields"> |
|
161 | <div class="fields"> | |
129 | <div class="field"> |
|
162 | <div class="field"> | |
130 | <div class="label label-radio"> |
|
163 | <div class="label label-radio"> | |
131 | ${_('Apply to children')}: |
|
164 | ${_('Apply to children')}: | |
132 | </div> |
|
165 | </div> | |
133 | <div class="radios"> |
|
166 | <div class="radios"> | |
134 | ${h.radio('recursive', 'none', label=_('None'), checked="checked")} |
|
167 | ${h.radio('recursive', 'none', label=_('None'), checked="checked")} | |
135 | ${h.radio('recursive', 'groups', label=_('Repository Groups'))} |
|
168 | ${h.radio('recursive', 'groups', label=_('Repository Groups'))} | |
136 | ${h.radio('recursive', 'repos', label=_('Repositories'))} |
|
169 | ${h.radio('recursive', 'repos', label=_('Repositories'))} | |
137 | ${h.radio('recursive', 'all', label=_('Both'))} |
|
170 | ${h.radio('recursive', 'all', label=_('Both'))} | |
138 | <span class="help-block">${_('Set or revoke permissions to selected types of children of this group, including non-private repositories and other groups if chosen.')}</span> |
|
171 | <span class="help-block">${_('Set or revoke permissions to selected types of children of this group, including non-private repositories and other groups if chosen.')}</span> | |
139 | </div> |
|
172 | </div> | |
140 | </div> |
|
173 | </div> | |
141 | </div> |
|
174 | </div> | |
142 | <div class="buttons"> |
|
175 | <div class="buttons"> | |
143 | ${h.submit('save',_('Save'),class_="btn btn-primary")} |
|
176 | ${h.submit('save',_('Save'),class_="btn btn-primary")} | |
144 | ${h.reset('reset',_('Reset'),class_="btn btn-danger")} |
|
177 | ${h.reset('reset',_('Reset'),class_="btn btn-danger")} | |
145 | </div> |
|
178 | </div> | |
146 | ${h.end_form()} |
|
179 | ${h.end_form()} | |
147 | </div> |
|
180 | </div> | |
148 | </div> |
|
181 | </div> | |
149 | <script type="text/javascript"> |
|
182 | <script type="text/javascript"> | |
150 | $('#add_perm').on('click', function(e){ |
|
183 | $('#add_perm').on('click', function(e){ | |
151 | addNewPermInput($(this), 'group'); |
|
184 | addNewPermInput($(this), 'group'); | |
152 | }); |
|
185 | }); | |
153 | $('.revoke_perm').on('click', function(e){ |
|
186 | $('.revoke_perm').on('click', function(e){ | |
154 | markRevokePermInput($(this), 'group'); |
|
187 | markRevokePermInput($(this), 'group'); | |
155 | }) |
|
188 | }) | |
156 | </script> |
|
189 | </script> |
@@ -1,135 +1,164 b'' | |||||
1 | <%namespace name="base" file="/base/base.mako"/> |
|
1 | <%namespace name="base" file="/base/base.mako"/> | |
2 |
|
2 | |||
3 | <div class="panel panel-default"> |
|
3 | <div class="panel panel-default"> | |
4 | <div class="panel-heading"> |
|
4 | <div class="panel-heading"> | |
5 | <h3 class="panel-title">${_('Repository Permissions')}</h3> |
|
5 | <h3 class="panel-title">${_('Repository Permissions')}</h3> | |
6 | </div> |
|
6 | </div> | |
7 | <div class="panel-body"> |
|
7 | <div class="panel-body"> | |
8 | ${h.secure_form(h.route_path('edit_repo_perms', repo_name=c.repo_name), request=request)} |
|
8 | ${h.secure_form(h.route_path('edit_repo_perms', repo_name=c.repo_name), request=request)} | |
9 | <table id="permissions_manage" class="rctable permissions"> |
|
9 | <table id="permissions_manage" class="rctable permissions"> | |
10 | <tr> |
|
10 | <tr> | |
11 | <th class="td-radio">${_('None')}</th> |
|
11 | <th class="td-radio">${_('None')}</th> | |
12 | <th class="td-radio">${_('Read')}</th> |
|
12 | <th class="td-radio">${_('Read')}</th> | |
13 | <th class="td-radio">${_('Write')}</th> |
|
13 | <th class="td-radio">${_('Write')}</th> | |
14 | <th class="td-radio">${_('Admin')}</th> |
|
14 | <th class="td-radio">${_('Admin')}</th> | |
15 | <th class="td-owner">${_('User/User Group')}</th> |
|
15 | <th class="td-owner">${_('User/User Group')}</th> | |
16 | <th></th> |
|
16 | <th></th> | |
|
17 | <th></th> | |||
17 | </tr> |
|
18 | </tr> | |
18 | ## USERS |
|
19 | ## USERS | |
19 | %for _user in c.rhodecode_db_repo.permissions(): |
|
20 | %for _user in c.rhodecode_db_repo.permissions(): | |
20 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): |
|
21 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): | |
21 | <tr class="perm_admin_row"> |
|
22 | <tr class="perm_admin_row"> | |
22 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> |
|
23 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> | |
23 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td> |
|
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td> | |
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td> |
|
25 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td> | |
25 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td> |
|
26 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td> | |
26 | <td class="td-user"> |
|
27 | <td class="td-user"> | |
27 | ${base.gravatar(_user.email, 16)} |
|
28 | ${base.gravatar(_user.email, 16)} | |
28 | ${h.link_to_user(_user.username)} |
|
29 | ${h.link_to_user(_user.username)} | |
29 | %if getattr(_user, 'admin_row', None): |
|
30 | %if getattr(_user, 'admin_row', None): | |
30 | (${_('super admin')}) |
|
31 | (${_('super admin')}) | |
31 | %endif |
|
32 | %endif | |
32 | %if getattr(_user, 'owner_row', None): |
|
33 | %if getattr(_user, 'owner_row', None): | |
33 | (${_('owner')}) |
|
34 | (${_('owner')}) | |
34 | %endif |
|
35 | %endif | |
35 | </td> |
|
36 | </td> | |
36 | <td></td> |
|
37 | <td></td> | |
|
38 | <td> | |||
|
39 | % if c.rhodecode_user.is_admin: | |||
|
40 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
41 | % endif | |||
|
42 | </td> | |||
37 | </tr> |
|
43 | </tr> | |
38 | %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private: |
|
44 | %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private: | |
39 | <tr> |
|
45 | <tr> | |
40 | <td colspan="4"> |
|
46 | <td colspan="4"> | |
41 | <span class="private_repo_msg"> |
|
47 | <span class="private_repo_msg"> | |
42 | <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong> |
|
48 | <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong> | |
43 | </span> |
|
49 | </span> | |
44 | </td> |
|
50 | </td> | |
45 | <td class="private_repo_msg"> |
|
51 | <td class="private_repo_msg"> | |
46 | ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)} |
|
52 | ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)} | |
47 | ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td> |
|
53 | ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td> | |
48 | <td></td> |
|
54 | <td></td> | |
|
55 | <td> | |||
|
56 | % if c.rhodecode_user.is_admin: | |||
|
57 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
|
58 | % endif | |||
|
59 | </td> | |||
49 | </tr> |
|
60 | </tr> | |
50 | %else: |
|
61 | %else: | |
51 | <tr> |
|
62 | <tr> | |
52 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none')}</td> |
|
63 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none')}</td> | |
53 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read')}</td> |
|
64 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read')}</td> | |
54 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.write', checked=_user.permission=='repository.write')}</td> |
|
65 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.write', checked=_user.permission=='repository.write')}</td> | |
55 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.admin', checked=_user.permission=='repository.admin')}</td> |
|
66 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.admin', checked=_user.permission=='repository.admin')}</td> | |
56 | <td class="td-user"> |
|
67 | <td class="td-user"> | |
57 | ${base.gravatar(_user.email, 16)} |
|
68 | ${base.gravatar(_user.email, 16)} | |
58 | <span class="user"> |
|
69 | <span class="user"> | |
59 | % if _user.username == h.DEFAULT_USER: |
|
70 | % if _user.username == h.DEFAULT_USER: | |
60 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
71 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
61 | % else: |
|
72 | % else: | |
62 | ${h.link_to_user(_user.username)} |
|
73 | ${h.link_to_user(_user.username)} | |
|
74 | %if getattr(_user, 'duplicate_perm', None): | |||
|
75 | (${_('inactive duplicate')}) | |||
|
76 | %endif | |||
63 | % endif |
|
77 | % endif | |
64 | </span> |
|
78 | </span> | |
65 | </td> |
|
79 | </td> | |
66 | <td class="td-action"> |
|
80 | <td class="td-action"> | |
67 | %if _user.username != h.DEFAULT_USER: |
|
81 | %if _user.username != h.DEFAULT_USER: | |
68 | <span class="btn btn-link btn-danger revoke_perm" |
|
82 | <span class="btn btn-link btn-danger revoke_perm" | |
69 | member="${_user.user_id}" member_type="user"> |
|
83 | member="${_user.user_id}" member_type="user"> | |
70 | ${_('Revoke')} |
|
84 | ${_('Revoke')} | |
71 | </span> |
|
85 | </span> | |
72 | %endif |
|
86 | %endif | |
73 | </td> |
|
87 | </td> | |
|
88 | <td> | |||
|
89 | % if c.rhodecode_user.is_admin: | |||
|
90 | % if _user.username == h.DEFAULT_USER: | |||
|
91 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
|
92 | % else: | |||
|
93 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
94 | % endif | |||
|
95 | % endif | |||
|
96 | </td> | |||
74 | </tr> |
|
97 | </tr> | |
75 | %endif |
|
98 | %endif | |
76 | %endfor |
|
99 | %endfor | |
77 |
|
100 | |||
78 | ## USER GROUPS |
|
101 | ## USER GROUPS | |
79 | %for _user_group in c.rhodecode_db_repo.permission_user_groups(): |
|
102 | %for _user_group in c.rhodecode_db_repo.permission_user_groups(): | |
80 | <tr> |
|
103 | <tr> | |
81 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}</td> |
|
104 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}</td> | |
82 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.read', checked=_user_group.permission=='repository.read')}</td> |
|
105 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.read', checked=_user_group.permission=='repository.read')}</td> | |
83 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.write', checked=_user_group.permission=='repository.write')}</td> |
|
106 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.write', checked=_user_group.permission=='repository.write')}</td> | |
84 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.admin', checked=_user_group.permission=='repository.admin')}</td> |
|
107 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.admin', checked=_user_group.permission=='repository.admin')}</td> | |
85 | <td class="td-componentname"> |
|
108 | <td class="td-componentname"> | |
86 | <i class="icon-user-group"></i> |
|
109 | <i class="icon-user-group"></i> | |
87 | %if h.HasPermissionAny('hg.admin')(): |
|
110 | %if h.HasPermissionAny('hg.admin')(): | |
88 | <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}"> |
|
111 | <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}"> | |
89 | ${_user_group.users_group_name} |
|
112 | ${_user_group.users_group_name} | |
90 | </a> |
|
113 | </a> | |
91 | %else: |
|
114 | %else: | |
92 | ${h.link_to_group(_user_group.users_group_name)} |
|
115 | ${h.link_to_group(_user_group.users_group_name)} | |
93 | %endif |
|
116 | %endif | |
94 | </td> |
|
117 | </td> | |
95 | <td class="td-action"> |
|
118 | <td class="td-action"> | |
96 | <span class="btn btn-link btn-danger revoke_perm" |
|
119 | <span class="btn btn-link btn-danger revoke_perm" | |
97 | member="${_user_group.users_group_id}" member_type="user_group"> |
|
120 | member="${_user_group.users_group_id}" member_type="user_group"> | |
98 | ${_('Revoke')} |
|
121 | ${_('Revoke')} | |
99 | </span> |
|
122 | </span> | |
100 | </td> |
|
123 | </td> | |
|
124 | <td> | |||
|
125 | % if c.rhodecode_user.is_admin: | |||
|
126 | ${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))} | |||
|
127 | % endif | |||
|
128 | </td> | |||
101 | </tr> |
|
129 | </tr> | |
102 | %endfor |
|
130 | %endfor | |
103 | <tr class="new_members" id="add_perm_input"></tr> |
|
131 | <tr class="new_members" id="add_perm_input"></tr> | |
104 |
|
132 | |||
105 | <tr> |
|
133 | <tr> | |
106 | <td></td> |
|
134 | <td></td> | |
107 | <td></td> |
|
135 | <td></td> | |
108 | <td></td> |
|
136 | <td></td> | |
109 | <td></td> |
|
137 | <td></td> | |
110 | <td></td> |
|
138 | <td></td> | |
111 | <td> |
|
139 | <td> | |
112 | <span id="add_perm" class="link"> |
|
140 | <span id="add_perm" class="link"> | |
113 | ${_('Add user/user group')} |
|
141 | ${_('Add user/user group')} | |
114 | </span> |
|
142 | </span> | |
115 | </td> |
|
143 | </td> | |
|
144 | <td></td> | |||
116 | </tr> |
|
145 | </tr> | |
117 |
|
146 | |||
118 | </table> |
|
147 | </table> | |
119 |
|
148 | |||
120 | <div class="buttons"> |
|
149 | <div class="buttons"> | |
121 | ${h.submit('save',_('Save'),class_="btn btn-primary")} |
|
150 | ${h.submit('save',_('Save'),class_="btn btn-primary")} | |
122 | ${h.reset('reset',_('Reset'),class_="btn btn-danger")} |
|
151 | ${h.reset('reset',_('Reset'),class_="btn btn-danger")} | |
123 | </div> |
|
152 | </div> | |
124 | ${h.end_form()} |
|
153 | ${h.end_form()} | |
125 | </div> |
|
154 | </div> | |
126 | </div> |
|
155 | </div> | |
127 |
|
156 | |||
128 | <script type="text/javascript"> |
|
157 | <script type="text/javascript"> | |
129 | $('#add_perm').on('click', function(e){ |
|
158 | $('#add_perm').on('click', function(e){ | |
130 | addNewPermInput($(this), 'repository'); |
|
159 | addNewPermInput($(this), 'repository'); | |
131 | }); |
|
160 | }); | |
132 | $('.revoke_perm').on('click', function(e){ |
|
161 | $('.revoke_perm').on('click', function(e){ | |
133 | markRevokePermInput($(this), 'repository'); |
|
162 | markRevokePermInput($(this), 'repository'); | |
134 | }); |
|
163 | }); | |
135 | </script> |
|
164 | </script> |
@@ -1,144 +1,177 b'' | |||||
1 | <%namespace name="base" file="/base/base.mako"/> |
|
1 | <%namespace name="base" file="/base/base.mako"/> | |
2 |
|
2 | |||
3 | <div class="panel panel-default"> |
|
3 | <div class="panel panel-default"> | |
4 | <div class="panel-heading"> |
|
4 | <div class="panel-heading"> | |
5 | <h3 class="panel-title">${_('User Group Permissions')}</h3> |
|
5 | <h3 class="panel-title">${_('User Group Permissions')}</h3> | |
6 | </div> |
|
6 | </div> | |
7 | <div class="panel-body"> |
|
7 | <div class="panel-body"> | |
8 | ${h.secure_form(h.route_path('edit_user_group_perms_update', user_group_id=c.user_group.users_group_id), request=request)} |
|
8 | ${h.secure_form(h.route_path('edit_user_group_perms_update', user_group_id=c.user_group.users_group_id), request=request)} | |
9 | <table id="permissions_manage" class="rctable permissions"> |
|
9 | <table id="permissions_manage" class="rctable permissions"> | |
10 | <tr> |
|
10 | <tr> | |
11 | <th class="td-radio">${_('None')}</th> |
|
11 | <th class="td-radio">${_('None')}</th> | |
12 | <th class="td-radio">${_('Read')}</th> |
|
12 | <th class="td-radio">${_('Read')}</th> | |
13 | <th class="td-radio">${_('Write')}</th> |
|
13 | <th class="td-radio">${_('Write')}</th> | |
14 | <th class="td-radio">${_('Admin')}</th> |
|
14 | <th class="td-radio">${_('Admin')}</th> | |
15 | <th>${_('User/User Group')}</th> |
|
15 | <th>${_('User/User Group')}</th> | |
16 | <th></th> |
|
16 | <th></th> | |
|
17 | <th></th> | |||
17 | </tr> |
|
18 | </tr> | |
18 | ## USERS |
|
19 | ## USERS | |
19 | %for _user in c.user_group.permissions(): |
|
20 | %for _user in c.user_group.permissions(): | |
|
21 | ## super admin/owner row | |||
20 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): |
|
22 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): | |
21 | <tr class="perm_admin_row"> |
|
23 | <tr class="perm_admin_row"> | |
22 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> |
|
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> | |
23 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td> |
|
25 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td> | |
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td> |
|
26 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td> | |
25 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td> |
|
27 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td> | |
26 | <td class="td-user"> |
|
28 | <td class="td-user"> | |
27 | ${base.gravatar(_user.email, 16)} |
|
29 | ${base.gravatar(_user.email, 16)} | |
28 | <span class="user"> |
|
30 | <span class="user"> | |
29 | ${h.link_to_user(_user.username)} |
|
31 | ${h.link_to_user(_user.username)} | |
30 | %if getattr(_user, 'admin_row', None): |
|
32 | %if getattr(_user, 'admin_row', None): | |
31 | (${_('super admin')}) |
|
33 | (${_('super admin')}) | |
32 | %endif |
|
34 | %endif | |
33 | %if getattr(_user, 'owner_row', None): |
|
35 | %if getattr(_user, 'owner_row', None): | |
34 | (${_('owner')}) |
|
36 | (${_('owner')}) | |
35 | %endif |
|
37 | %endif | |
36 | </span> |
|
38 | </span> | |
37 | </td> |
|
39 | </td> | |
38 | <td></td> |
|
40 | <td></td> | |
|
41 | <td> | |||
|
42 | % if c.rhodecode_user.is_admin: | |||
|
43 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
44 | % endif | |||
|
45 | </td> | |||
39 | </tr> |
|
46 | </tr> | |
40 | %else: |
|
47 | %else: | |
41 | ##forbid revoking permission from yourself, except if you're an super admin |
|
48 | ##forbid revoking permission from yourself, except if you're an super admin | |
42 | <tr> |
|
49 | <tr> | |
43 | %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin: |
|
50 | %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin: | |
44 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none')}</td> |
|
51 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none')}</td> | |
45 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read')}</td> |
|
52 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read')}</td> | |
46 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write')}</td> |
|
53 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write')}</td> | |
47 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin')}</td> |
|
54 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin')}</td> | |
48 | <td class="td-user"> |
|
55 | <td class="td-user"> | |
49 | ${base.gravatar(_user.email, 16)} |
|
56 | ${base.gravatar(_user.email, 16)} | |
50 | <span class="user"> |
|
57 | <span class="user"> | |
51 | % if _user.username == h.DEFAULT_USER: |
|
58 | % if _user.username == h.DEFAULT_USER: | |
52 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
59 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
53 | % else: |
|
60 | % else: | |
54 | ${h.link_to_user(_user.username)} |
|
61 | ${h.link_to_user(_user.username)} | |
|
62 | %if getattr(_user, 'duplicate_perm', None): | |||
|
63 | (${_('inactive duplicate')}) | |||
|
64 | %endif | |||
55 | % endif |
|
65 | % endif | |
56 | </span> |
|
66 | </span> | |
57 | </td> |
|
67 | </td> | |
58 | <td class="td-action"> |
|
68 | <td class="td-action"> | |
59 | %if _user.username != h.DEFAULT_USER: |
|
69 | %if _user.username != h.DEFAULT_USER: | |
60 | <span class="btn btn-link btn-danger revoke_perm" |
|
70 | <span class="btn btn-link btn-danger revoke_perm" | |
61 | member="${_user.user_id}" member_type="user"> |
|
71 | member="${_user.user_id}" member_type="user"> | |
62 | ${_('Revoke')} |
|
72 | ${_('Revoke')} | |
63 | </span> |
|
73 | </span> | |
64 | %endif |
|
74 | %endif | |
65 | </td> |
|
75 | </td> | |
|
76 | <td> | |||
|
77 | % if c.rhodecode_user.is_admin: | |||
|
78 | % if _user.username == h.DEFAULT_USER: | |||
|
79 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
|
80 | % else: | |||
|
81 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
82 | % endif | |||
|
83 | % endif | |||
|
84 | </td> | |||
66 | %else: |
|
85 | %else: | |
67 | ## special case for current user permissions, we make sure he cannot take his own permissions |
|
86 | ## special case for currently logged-in user permissions, we make sure he cannot take his own permissions | |
68 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none', disabled="disabled")}</td> |
|
87 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none', disabled="disabled")}</td> | |
69 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read', disabled="disabled")}</td> |
|
88 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read', disabled="disabled")}</td> | |
70 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write', disabled="disabled")}</td> |
|
89 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write', disabled="disabled")}</td> | |
71 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin', disabled="disabled")}</td> |
|
90 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin', disabled="disabled")}</td> | |
72 | <td class="td-user"> |
|
91 | <td class="td-user"> | |
73 | ${base.gravatar(_user.email, 16)} |
|
92 | ${base.gravatar(_user.email, 16)} | |
74 | <span class="user"> |
|
93 | <span class="user"> | |
75 | % if _user.username == h.DEFAULT_USER: |
|
94 | % if _user.username == h.DEFAULT_USER: | |
76 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
95 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
77 | % else: |
|
96 | % else: | |
78 | ${h.link_to_user(_user.username)} |
|
97 | ${h.link_to_user(_user.username)} | |
|
98 | %if getattr(_user, 'duplicate_perm', None): | |||
|
99 | (${_('inactive duplicate')}) | |||
|
100 | %endif | |||
79 | % endif |
|
101 | % endif | |
80 | <span class="user-perm-help-text">(${_('delegated admin')})</span> |
|
102 | <span class="user-perm-help-text">(${_('delegated admin')})</span> | |
81 | </span> |
|
103 | </span> | |
82 | </td> |
|
104 | </td> | |
83 | <td></td> |
|
105 | <td></td> | |
|
106 | <td> | |||
|
107 | % if c.rhodecode_user.is_admin: | |||
|
108 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
109 | % endif | |||
|
110 | </td> | |||
84 | %endif |
|
111 | %endif | |
85 | </tr> |
|
112 | </tr> | |
86 | %endif |
|
113 | %endif | |
87 | %endfor |
|
114 | %endfor | |
88 |
|
115 | |||
89 | ## USER GROUPS |
|
116 | ## USER GROUPS | |
90 | %for _user_group in c.user_group.permission_user_groups(): |
|
117 | %for _user_group in c.user_group.permission_user_groups(): | |
91 | <tr> |
|
118 | <tr> | |
92 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.none')}</td> |
|
119 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.none')}</td> | |
93 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.read')}</td> |
|
120 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.read')}</td> | |
94 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.write')}</td> |
|
121 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.write')}</td> | |
95 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.admin')}</td> |
|
122 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.admin')}</td> | |
96 | <td class="td-user"> |
|
123 | <td class="td-user"> | |
97 | <i class="icon-user-group"></i> |
|
124 | <i class="icon-user-group"></i> | |
98 | %if h.HasPermissionAny('hg.admin')(): |
|
125 | %if h.HasPermissionAny('hg.admin')(): | |
99 | <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}"> |
|
126 | <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}"> | |
100 | ${_user_group.users_group_name} |
|
127 | ${_user_group.users_group_name} | |
101 | </a> |
|
128 | </a> | |
102 | %else: |
|
129 | %else: | |
103 | ${h.link_to_group(_user_group.users_group_name)} |
|
130 | ${h.link_to_group(_user_group.users_group_name)} | |
104 | %endif |
|
131 | %endif | |
105 | </td> |
|
132 | </td> | |
106 | <td class="td-action"> |
|
133 | <td class="td-action"> | |
107 | <span class="btn btn-link btn-danger revoke_perm" |
|
134 | <span class="btn btn-link btn-danger revoke_perm" | |
108 | member="${_user_group.users_group_id}" member_type="user_group"> |
|
135 | member="${_user_group.users_group_id}" member_type="user_group"> | |
109 | ${_('Revoke')} |
|
136 | ${_('Revoke')} | |
110 | </span> |
|
137 | </span> | |
111 | </td> |
|
138 | </td> | |
|
139 | <td> | |||
|
140 | % if c.rhodecode_user.is_admin: | |||
|
141 | ${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))} | |||
|
142 | % endif | |||
|
143 | </td> | |||
112 | </tr> |
|
144 | </tr> | |
113 | %endfor |
|
145 | %endfor | |
114 | <tr class="new_members" id="add_perm_input"></tr> |
|
146 | <tr class="new_members" id="add_perm_input"></tr> | |
115 | <tr> |
|
147 | <tr> | |
116 | <td></td> |
|
148 | <td></td> | |
117 | <td></td> |
|
149 | <td></td> | |
118 | <td></td> |
|
150 | <td></td> | |
119 | <td></td> |
|
151 | <td></td> | |
120 | <td></td> |
|
152 | <td></td> | |
121 | <td> |
|
153 | <td> | |
122 | <span id="add_perm" class="link"> |
|
154 | <span id="add_perm" class="link"> | |
123 | ${_('Add user/user group')} |
|
155 | ${_('Add user/user group')} | |
124 | </span> |
|
156 | </span> | |
125 | </td> |
|
157 | </td> | |
|
158 | <td></td> | |||
126 | </tr> |
|
159 | </tr> | |
127 | </table> |
|
160 | </table> | |
128 |
|
161 | |||
129 | <div class="buttons"> |
|
162 | <div class="buttons"> | |
130 | ${h.submit('save',_('Save'),class_="btn btn-primary")} |
|
163 | ${h.submit('save',_('Save'),class_="btn btn-primary")} | |
131 | ${h.reset('reset',_('Reset'),class_="btn btn-danger")} |
|
164 | ${h.reset('reset',_('Reset'),class_="btn btn-danger")} | |
132 | </div> |
|
165 | </div> | |
133 | ${h.end_form()} |
|
166 | ${h.end_form()} | |
134 | </div> |
|
167 | </div> | |
135 | </div> |
|
168 | </div> | |
136 |
|
169 | |||
137 | <script type="text/javascript"> |
|
170 | <script type="text/javascript"> | |
138 | $('#add_perm').on('click', function(e){ |
|
171 | $('#add_perm').on('click', function(e){ | |
139 | addNewPermInput($(this), 'usergroup'); |
|
172 | addNewPermInput($(this), 'usergroup'); | |
140 | }); |
|
173 | }); | |
141 | $('.revoke_perm').on('click', function(e){ |
|
174 | $('.revoke_perm').on('click', function(e){ | |
142 | markRevokePermInput($(this), 'usergroup'); |
|
175 | markRevokePermInput($(this), 'usergroup'); | |
143 | }); |
|
176 | }); | |
144 | </script> |
|
177 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now