##// END OF EJS Templates
branch-rules forbid removal of permissions assigned.
marcink -
r2977:239b4827 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
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,164 +1,172 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 <th></th>
18 </tr>
18 </tr>
19 ## USERS
19 ## USERS
20 %for _user in c.rhodecode_db_repo.permissions():
20 %for _user in c.rhodecode_db_repo.permissions():
21 %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):
22 <tr class="perm_admin_row">
22 <tr class="perm_admin_row">
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.none', 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.read', 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.write', 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-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
27 <td class="td-user">
27 <td class="td-user">
28 ${base.gravatar(_user.email, 16)}
28 ${base.gravatar(_user.email, 16)}
29 ${h.link_to_user(_user.username)}
29 ${h.link_to_user(_user.username)}
30 %if getattr(_user, 'admin_row', None):
30 %if getattr(_user, 'admin_row', None):
31 (${_('super admin')})
31 (${_('super admin')})
32 %endif
32 %endif
33 %if getattr(_user, 'owner_row', None):
33 %if getattr(_user, 'owner_row', None):
34 (${_('owner')})
34 (${_('owner')})
35 %endif
35 %endif
36 </td>
36 </td>
37 <td></td>
37 <td></td>
38 <td>
38 <td>
39 % if c.rhodecode_user.is_admin:
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'))}
40 ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))}
41 % endif
41 % endif
42 </td>
42 </td>
43 </tr>
43 </tr>
44 %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:
45 <tr>
45 <tr>
46 <td colspan="4">
46 <td colspan="4">
47 <span class="private_repo_msg">
47 <span class="private_repo_msg">
48 <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong>
48 <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong>
49 </span>
49 </span>
50 </td>
50 </td>
51 <td class="private_repo_msg">
51 <td class="private_repo_msg">
52 ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)}
52 ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)}
53 ${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>
54 <td></td>
54 <td></td>
55 <td>
55 <td>
56 % if c.rhodecode_user.is_admin:
56 % if c.rhodecode_user.is_admin:
57 ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))}
57 ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))}
58 % endif
58 % endif
59 </td>
59 </td>
60 </tr>
60 </tr>
61 %else:
61 %else:
62 <tr>
62 <tr>
63 <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>
64 <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>
65 <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>
66 <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>
67 <td class="td-user">
67 <td class="td-user">
68 ${base.gravatar(_user.email, 16)}
68 ${base.gravatar(_user.email, 16)}
69 <span class="user">
69 <span class="user">
70 % if _user.username == h.DEFAULT_USER:
70 % if _user.username == h.DEFAULT_USER:
71 ${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>
72 % else:
72 % else:
73 ${h.link_to_user(_user.username)}
73 ${h.link_to_user(_user.username)}
74 %if getattr(_user, 'duplicate_perm', None):
74 %if getattr(_user, 'duplicate_perm', None):
75 (${_('inactive duplicate')})
75 (${_('inactive duplicate')})
76 %endif
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 % endif
85 % endif
78 </span>
86 </span>
79 </td>
87 </td>
80 <td class="td-action">
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 <span class="btn btn-link btn-danger revoke_perm"
90 <span class="btn btn-link btn-danger revoke_perm"
83 member="${_user.user_id}" member_type="user">
91 member="${_user.user_id}" member_type="user">
84 ${_('Revoke')}
92 ${_('Revoke')}
85 </span>
93 </span>
86 %endif
94 %endif
87 </td>
95 </td>
88 <td>
96 <td>
89 % if c.rhodecode_user.is_admin:
97 % if c.rhodecode_user.is_admin:
90 % if _user.username == h.DEFAULT_USER:
98 % if _user.username == h.DEFAULT_USER:
91 ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))}
99 ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))}
92 % else:
100 % else:
93 ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))}
101 ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))}
94 % endif
102 % endif
95 % endif
103 % endif
96 </td>
104 </td>
97 </tr>
105 </tr>
98 %endif
106 %endif
99 %endfor
107 %endfor
100
108
101 ## USER GROUPS
109 ## USER GROUPS
102 %for _user_group in c.rhodecode_db_repo.permission_user_groups():
110 %for _user_group in c.rhodecode_db_repo.permission_user_groups():
103 <tr>
111 <tr>
104 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}</td>
112 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}</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>
113 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.read', checked=_user_group.permission=='repository.read')}</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>
114 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.write', checked=_user_group.permission=='repository.write')}</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>
115 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.admin', checked=_user_group.permission=='repository.admin')}</td>
108 <td class="td-componentname">
116 <td class="td-componentname">
109 <i class="icon-user-group"></i>
117 <i class="icon-user-group"></i>
110 %if h.HasPermissionAny('hg.admin')():
118 %if h.HasPermissionAny('hg.admin')():
111 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
119 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
112 ${_user_group.users_group_name}
120 ${_user_group.users_group_name}
113 </a>
121 </a>
114 %else:
122 %else:
115 ${h.link_to_group(_user_group.users_group_name)}
123 ${h.link_to_group(_user_group.users_group_name)}
116 %endif
124 %endif
117 </td>
125 </td>
118 <td class="td-action">
126 <td class="td-action">
119 <span class="btn btn-link btn-danger revoke_perm"
127 <span class="btn btn-link btn-danger revoke_perm"
120 member="${_user_group.users_group_id}" member_type="user_group">
128 member="${_user_group.users_group_id}" member_type="user_group">
121 ${_('Revoke')}
129 ${_('Revoke')}
122 </span>
130 </span>
123 </td>
131 </td>
124 <td>
132 <td>
125 % if c.rhodecode_user.is_admin:
133 % 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'))}
134 ${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
135 % endif
128 </td>
136 </td>
129 </tr>
137 </tr>
130 %endfor
138 %endfor
131 <tr class="new_members" id="add_perm_input"></tr>
139 <tr class="new_members" id="add_perm_input"></tr>
132
140
133 <tr>
141 <tr>
134 <td></td>
142 <td></td>
135 <td></td>
143 <td></td>
136 <td></td>
144 <td></td>
137 <td></td>
145 <td></td>
138 <td></td>
146 <td></td>
139 <td>
147 <td>
140 <span id="add_perm" class="link">
148 <span id="add_perm" class="link">
141 ${_('Add user/user group')}
149 ${_('Add user/user group')}
142 </span>
150 </span>
143 </td>
151 </td>
144 <td></td>
152 <td></td>
145 </tr>
153 </tr>
146
154
147 </table>
155 </table>
148
156
149 <div class="buttons">
157 <div class="buttons">
150 ${h.submit('save',_('Save'),class_="btn btn-primary")}
158 ${h.submit('save',_('Save'),class_="btn btn-primary")}
151 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
159 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
152 </div>
160 </div>
153 ${h.end_form()}
161 ${h.end_form()}
154 </div>
162 </div>
155 </div>
163 </div>
156
164
157 <script type="text/javascript">
165 <script type="text/javascript">
158 $('#add_perm').on('click', function(e){
166 $('#add_perm').on('click', function(e){
159 addNewPermInput($(this), 'repository');
167 addNewPermInput($(this), 'repository');
160 });
168 });
161 $('.revoke_perm').on('click', function(e){
169 $('.revoke_perm').on('click', function(e){
162 markRevokePermInput($(this), 'repository');
170 markRevokePermInput($(this), 'repository');
163 });
171 });
164 </script>
172 </script>
General Comments 0
You need to be logged in to leave comments. Login now