##// END OF EJS Templates
permissions: add links to permissions summary for each permission pages
marcink -
r2976:b8a47c7e default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

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