##// END OF EJS Templates
fixed sort of permissions summary it's now perm+name...
marcink -
r3666:fda60c2a beta
parent child Browse files
Show More
@@ -0,0 +1,63 b''
1 ## snippet for displaying permissions overview for users
2
3 <%def name="perms_summary(permissions)">
4 <div id="perms" class="table">
5 %for section in sorted(permissions.keys()):
6 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
7 %if not permissions[section]:
8 <span class="empty_data">${_('No permissions defined yet')}</span>
9 %else:
10 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
11 <table id="tbl_list_${section}">
12 <thead>
13 <tr>
14 <th class="left">${_('Name')}</th>
15 <th class="left">${_('Permission')}</th>
16 <th class="left">${_('Edit Permission')}</th>
17 </thead>
18 <tbody>
19 %if section == 'global':
20 %for k in sorted(permissions[section], key=lambda s: s.lower()):
21 <tr>
22 <td>
23 ${h.get_permission_name(k)}
24 </td>
25 <td>
26 ${h.boolicon(k.split('.')[-1] != 'none')}
27 </td>
28 <td>
29 <a href="${h.url('edit_permission', id='default')}">${_('edit')}</a>
30 </td>
31 </tr>
32 %endfor
33 %else:
34 %for k, section_perm in sorted(permissions[section].items(), key=lambda s: s[1]+s[0].lower()):
35 <tr>
36 <td>
37 %if section == 'repositories':
38 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
39 %elif section == 'repositories_groups':
40 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
41 %endif
42 </td>
43 <td>
44 <span class="perm_tag ${section_perm.split('.')[-1]}">${section_perm}</span>
45 </td>
46 <td>
47 %if section == 'repositories':
48 <a href="${h.url('edit_repo',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
49 %elif section == 'repositories_groups':
50 <a href="${h.url('edit_repos_group',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
51 %endif
52 </td>
53 </tr>
54 %endfor
55 %endif
56
57 </tbody>
58 </table>
59 </div>
60 %endif
61 %endfor
62 </div>
63 </%def>
@@ -1,215 +1,160 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Permissions administration')} &middot; ${c.rhodecode_name}
6 6 </%def>
7 7
8 8 <%def name="breadcrumbs_links()">
9 9 ${h.link_to(_('Admin'),h.url('admin_home'))}
10 10 &raquo;
11 11 ${_('Permissions')}
12 12 </%def>
13 13
14 14 <%def name="page_nav()">
15 15 ${self.menu('admin')}
16 16 </%def>
17 17
18 18 <%def name="main()">
19 19 <div class="box box-left">
20 20 <!-- box / title -->
21 21 <div class="title">
22 22 ${self.breadcrumbs()}
23 23 </div>
24 24 <h3>${_('Default permissions')}</h3>
25 25 ${h.form(url('permission', id='default'),method='put')}
26 26 <div class="form">
27 27 <!-- fields -->
28 28 <div class="fields">
29 29 <div class="field">
30 30 <div class="label label-checkbox">
31 31 <label for="anonymous">${_('Anonymous access')}:</label>
32 32 </div>
33 33 <div class="checkboxes">
34 34 <div class="checkbox">
35 35 ${h.checkbox('anonymous',True)}
36 36 </div>
37 37 </div>
38 38 </div>
39 39 <div class="field">
40 40 <div class="label">
41 41 <label for="default_repo_perm">${_('Repository')}:</label>
42 42 </div>
43 43 <div class="select">
44 44 ${h.select('default_repo_perm','',c.repo_perms_choices)}
45 45
46 46 ${h.checkbox('overwrite_default_repo','true')}
47 47 <label for="overwrite_default_repo">
48 48 <span class="tooltip"
49 49 title="${h.tooltip(_('All default permissions on each repository will be reset to chosen permission, note that all custom default permission on repositories will be lost'))}">
50 50 ${_('Overwrite existing settings')}</span> </label>
51 51 </div>
52 52 </div>
53 53 <div class="field">
54 54 <div class="label">
55 55 <label for="default_group_perm">${_('Repository group')}:</label>
56 56 </div>
57 57 <div class="select">
58 58 ${h.select('default_group_perm','',c.group_perms_choices)}
59 59 ${h.checkbox('overwrite_default_group','true')}
60 60 <label for="overwrite_default_group">
61 61 <span class="tooltip"
62 62 title="${h.tooltip(_('All default permissions on each repository group will be reset to chosen permission, note that all custom default permission on repository groups will be lost'))}">
63 63 ${_('Overwrite existing settings')}</span> </label>
64 64
65 65 </div>
66 66 </div>
67 67 <div class="field">
68 68 <div class="label">
69 69 <label for="default_register">${_('Registration')}:</label>
70 70 </div>
71 71 <div class="select">
72 72 ${h.select('default_register','',c.register_choices)}
73 73 </div>
74 74 </div>
75 75 <div class="field">
76 76 <div class="label">
77 77 <label for="default_create">${_('Repository creation')}:</label>
78 78 </div>
79 79 <div class="select">
80 80 ${h.select('default_create','',c.create_choices)}
81 81 </div>
82 82 </div>
83 83 <div class="field">
84 84 <div class="label">
85 85 <label for="default_fork">${_('Repository forking')}:</label>
86 86 </div>
87 87 <div class="select">
88 88 ${h.select('default_fork','',c.fork_choices)}
89 89 </div>
90 90 </div>
91 91 <div class="buttons">
92 92 ${h.submit('save',_('Save'),class_="ui-btn large")}
93 93 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
94 94 </div>
95 95 </div>
96 96 </div>
97 97 ${h.end_form()}
98 98 </div>
99 99
100 100 <div style="min-height:780px" class="box box-right">
101 101 <!-- box / title -->
102 102 <div class="title">
103 103 <h5>${_('Default User Permissions')}</h5>
104 104 </div>
105 105
106 106 ## permissions overview
107 <div id="perms" class="table">
108 %for section in sorted(c.perm_user.permissions.keys()):
109 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
110 %if not c.perm_user.permissions[section]:
111 <span class="empty_data">${_('Nothing here yet')}</span>
112 %else:
113 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
114 <table id="tbl_list_${section}">
115 <thead>
116 <tr>
117 <th class="left">${_('Name')}</th>
118 <th class="left">${_('Permission')}</th>
119 <th class="left">${_('Edit Permission')}</th>
120 </thead>
121 <tbody>
122 %for k in sorted(c.perm_user.permissions[section], key=lambda s: s.lower):
123 <%
124 if section != 'global':
125 section_perm = c.perm_user.permissions[section].get(k)
126 _perm = section_perm.split('.')[-1]
127 else:
128 _perm = section_perm = None
129 %>
130 <tr>
131 <td>
132 %if section == 'repositories':
133 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
134 %elif section == 'repositories_groups':
135 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
136 %else:
137 ${h.get_permission_name(k)}
138 %endif
139 </td>
140 <td>
141 %if section == 'global':
142 ${h.boolicon(k.split('.')[-1] != 'none')}
143 %else:
144 <span class="perm_tag ${_perm}">${section_perm}</span>
145 %endif
146 </td>
147 <td>
148 %if section == 'repositories':
149 <a href="${h.url('edit_repo',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
150 %elif section == 'repositories_groups':
151 <a href="${h.url('edit_repos_group',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
152 %else:
153 --
154 %endif
155 </td>
156 </tr>
157 %endfor
158 </tbody>
159 </table>
160 </div>
161 %endif
162 %endfor
163 </div>
107 <%include file="/base/perms_summary.html"/>
108
164 109 </div>
165 110 <div class="box box-left" style="clear:left">
166 111 <!-- box / title -->
167 112 <div class="title">
168 113 <h5>${_('Allowed IP addresses')}</h5>
169 114 </div>
170 115
171 116 <div class="ips_wrap">
172 117 <table class="noborder">
173 118 %if c.user_ip_map:
174 119 %for ip in c.user_ip_map:
175 120 <tr>
176 121 <td><div class="ip">${ip.ip_addr}</div></td>
177 122 <td><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
178 123 <td>
179 124 ${h.form(url('user_ips_delete', id=c.user.user_id),method='delete')}
180 125 ${h.hidden('del_ip',ip.ip_id)}
181 126 ${h.hidden('default_user', 'True')}
182 127 ${h.submit('remove_',_('delete'),id="remove_ip_%s" % ip.ip_id,
183 128 class_="delete_icon action_button", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
184 129 ${h.end_form()}
185 130 </td>
186 131 </tr>
187 132 %endfor
188 133 %else:
189 134 <tr><td><div class="ip">${_('All IP addresses are allowed')}</div></td></tr>
190 135 %endif
191 136 </table>
192 137 </div>
193 138
194 139 ${h.form(url('user_ips', id=c.user.user_id),method='put')}
195 140 <div class="form">
196 141 <!-- fields -->
197 142 <div class="fields">
198 143 <div class="field">
199 144 <div class="label">
200 145 <label for="new_ip">${_('New ip address')}:</label>
201 146 </div>
202 147 <div class="input">
203 148 ${h.hidden('default_user', 'True')}
204 149 ${h.text('new_ip', class_='medium')}
205 150 </div>
206 151 </div>
207 152 <div class="buttons">
208 153 ${h.submit('save',_('Add'),class_="ui-btn large")}
209 154 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
210 155 </div>
211 156 </div>
212 157 </div>
213 158 ${h.end_form()}
214 159 </div>
215 160 </%def>
@@ -1,343 +1,289 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Edit user')} ${c.user.username} &middot; ${c.rhodecode_name}
6 6 </%def>
7 7
8 8 <%def name="breadcrumbs_links()">
9 9 ${h.link_to(_('Admin'),h.url('admin_home'))}
10 10 &raquo;
11 11 ${h.link_to(_('Users'),h.url('users'))}
12 12 &raquo;
13 13 ${_('Edit %s') % c.user.username}
14 14 </%def>
15 15
16 16 <%def name="page_nav()">
17 17 ${self.menu('admin')}
18 18 </%def>
19 19
20 20 <%def name="main()">
21 21 <div class="box box-left">
22 22 <!-- box / title -->
23 23 <div class="title">
24 24 ${self.breadcrumbs()}
25 25 </div>
26 26 <!-- end box / title -->
27 27 ${h.form(url('update_user', id=c.user.user_id),method='put')}
28 28 <div class="form">
29 29 <div class="field">
30 30 <div class="gravatar_box">
31 31 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div>
32 32 <p>
33 33 %if c.use_gravatar:
34 34 <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong>
35 35 <br/>${_('Using')} ${c.user.email}
36 36 %else:
37 37 <br/>${c.user.email}
38 38 %endif
39 39 </div>
40 40 </div>
41 41 <div class="field">
42 42 <div class="label">
43 43 <label>${_('API key')}:</label> ${c.user.api_key}
44 44 </div>
45 45 </div>
46 46 ##show current ip just if we show ourself
47 47 %if c.rhodecode_user.username == c.user.username:
48 48 <div class="field">
49 49 <div class="label">
50 50 <label>${_('Current IP')}:</label> ${c.perm_user.ip_addr or "?"}
51 51 </div>
52 52 </div>
53 53 %endif
54 54 <div class="fields">
55 55 <div class="field">
56 56 <div class="label">
57 57 <label for="username">${_('Username')}:</label>
58 58 </div>
59 59 <div class="input">
60 60 %if c.ldap_dn:
61 61 ${h.text('username',class_='medium disabled', readonly="readonly")}
62 62 %else:
63 63 ${h.text('username',class_='medium')}
64 64 %endif:
65 65 </div>
66 66 </div>
67 67
68 68 <div class="field">
69 69 <div class="label">
70 70 <label for="ldap_dn">${_('LDAP DN')}:</label>
71 71 </div>
72 72 <div class="input">
73 73 ${h.text('ldap_dn',class_='medium disabled',readonly="readonly")}
74 74 </div>
75 75 </div>
76 76
77 77 <div class="field">
78 78 <div class="label">
79 79 <label for="new_password">${_('New password')}:</label>
80 80 </div>
81 81 <div class="input">
82 82 ${h.password('new_password',class_='medium',autocomplete="off")}
83 83 </div>
84 84 </div>
85 85
86 86 <div class="field">
87 87 <div class="label">
88 88 <label for="password_confirmation">${_('New password confirmation')}:</label>
89 89 </div>
90 90 <div class="input">
91 91 ${h.password('password_confirmation',class_="medium",autocomplete="off")}
92 92 </div>
93 93 </div>
94 94
95 95 <div class="field">
96 96 <div class="label">
97 97 <label for="firstname">${_('First Name')}:</label>
98 98 </div>
99 99 <div class="input">
100 100 ${h.text('firstname',class_='medium')}
101 101 </div>
102 102 </div>
103 103
104 104 <div class="field">
105 105 <div class="label">
106 106 <label for="lastname">${_('Last Name')}:</label>
107 107 </div>
108 108 <div class="input">
109 109 ${h.text('lastname',class_='medium')}
110 110 </div>
111 111 </div>
112 112
113 113 <div class="field">
114 114 <div class="label">
115 115 <label for="email">${_('Email')}:</label>
116 116 </div>
117 117 <div class="input">
118 118 ${h.text('email',class_='medium')}
119 119 </div>
120 120 </div>
121 121
122 122 <div class="field">
123 123 <div class="label label-checkbox">
124 124 <label for="active">${_('Active')}:</label>
125 125 </div>
126 126 <div class="checkboxes">
127 127 ${h.checkbox('active',value=True)}
128 128 </div>
129 129 </div>
130 130
131 131 <div class="field">
132 132 <div class="label label-checkbox">
133 133 <label for="admin">${_('Admin')}:</label>
134 134 </div>
135 135 <div class="checkboxes">
136 136 ${h.checkbox('admin',value=True)}
137 137 </div>
138 138 </div>
139 139 <div class="buttons">
140 140 ${h.submit('save',_('Save'),class_="ui-btn large")}
141 141 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
142 142 </div>
143 143 </div>
144 144 </div>
145 145 ${h.end_form()}
146 146 </div>
147 147 <div style="min-height:780px" class="box box-right">
148 148 <!-- box / title -->
149 149 <div class="title">
150 150 <h5>${_('Permissions')}</h5>
151 151 </div>
152 152 ${h.form(url('user_perm', id=c.user.user_id),method='put')}
153 153 <div class="form">
154 154 <!-- fields -->
155 155 <div class="fields">
156 156 <div class="field">
157 157 <div class="label label-checkbox">
158 158 <label for="inherit_permissions">${_('Inherit default permissions')}:</label>
159 159 </div>
160 160 <div class="checkboxes">
161 161 ${h.checkbox('inherit_default_permissions',value=True)}
162 162 </div>
163 163 <span class="help-block">${h.literal(_('Select to inherit permissions from %s settings. '
164 164 'With this selected below options does not have any action') % h.link_to('default', url('edit_permission', id='default')))}</span>
165 165 </div>
166 166 <div id="inherit_overlay" style="${'opacity:0.3' if c.user.inherit_default_permissions else ''}" >
167 167 <div class="field">
168 168 <div class="label label-checkbox">
169 169 <label for="create_repo_perm">${_('Create repositories')}:</label>
170 170 </div>
171 171 <div class="checkboxes">
172 172 ${h.checkbox('create_repo_perm',value=True)}
173 173 </div>
174 174 </div>
175 175 <div class="field">
176 176 <div class="label label-checkbox">
177 177 <label for="fork_repo_perm">${_('Fork repositories')}:</label>
178 178 </div>
179 179 <div class="checkboxes">
180 180 ${h.checkbox('fork_repo_perm',value=True)}
181 181 </div>
182 182 </div>
183 183 </div>
184 184 <div class="buttons">
185 185 ${h.submit('save',_('Save'),class_="ui-btn large")}
186 186 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
187 187 </div>
188 188 </div>
189 189 </div>
190 190 ${h.end_form()}
191 191
192 192 ## permissions overview
193 <div id="perms" class="table">
194 %for section in sorted(c.perm_user.permissions.keys()):
195 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
196 %if not c.perm_user.permissions[section]:
197 <span class="empty_data">${_('Nothing here yet')}</span>
198 %else:
199 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
200 <table id="tbl_list_${section}">
201 <thead>
202 <tr>
203 <th class="left">${_('Name')}</th>
204 <th class="left">${_('Permission')}</th>
205 <th class="left">${_('Edit Permission')}</th>
206 </thead>
207 <tbody>
208 %for k in sorted(c.perm_user.permissions[section], key=lambda s: s.lower):
209 <%
210 if section != 'global':
211 section_perm = c.perm_user.permissions[section].get(k)
212 _perm = section_perm.split('.')[-1]
213 else:
214 _perm = section_perm = None
215 %>
216 <tr>
217 <td>
218 %if section == 'repositories':
219 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
220 %elif section == 'repositories_groups':
221 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
222 %else:
223 ${h.get_permission_name(k)}
224 %endif
225 </td>
226 <td>
227 %if section == 'global':
228 ${h.boolicon(k.split('.')[-1] != 'none')}
229 %else:
230 <span class="perm_tag ${_perm}">${section_perm}</span>
231 %endif
232 </td>
233 <td>
234 %if section == 'repositories':
235 <a href="${h.url('edit_repo',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
236 %elif section == 'repositories_groups':
237 <a href="${h.url('edit_repos_group',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
238 %else:
239 --
240 %endif
241 </td>
242 </tr>
243 %endfor
244 </tbody>
245 </table>
246 </div>
247 %endif
248 %endfor
249 </div>
193 <%namespace name="p" file="/base/perms_summary.html"/>
194 ${p.perms_summary(c.perm_user.permissions)}
195
250 196 </div>
251 197 <div class="box box-left" style="clear:left">
252 198 <!-- box / title -->
253 199 <div class="title">
254 200 <h5>${_('Email addresses')}</h5>
255 201 </div>
256 202
257 203 <div class="emails_wrap">
258 204 <table class="noborder">
259 205 %for em in c.user_email_map:
260 206 <tr>
261 207 <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(em.user.email,16)}"/> </div></td>
262 208 <td><div class="email">${em.email}</div></td>
263 209 <td>
264 210 ${h.form(url('user_emails_delete', id=c.user.user_id),method='delete')}
265 211 ${h.hidden('del_email',em.email_id)}
266 212 ${h.submit('remove_',_('delete'),id="remove_email_%s" % em.email_id,
267 213 class_="delete_icon action_button", onclick="return confirm('"+_('Confirm to delete this email: %s') % em.email+"');")}
268 214 ${h.end_form()}
269 215 </td>
270 216 </tr>
271 217 %endfor
272 218 </table>
273 219 </div>
274 220
275 221 ${h.form(url('user_emails', id=c.user.user_id),method='put')}
276 222 <div class="form">
277 223 <!-- fields -->
278 224 <div class="fields">
279 225 <div class="field">
280 226 <div class="label">
281 227 <label for="new_email">${_('New email address')}:</label>
282 228 </div>
283 229 <div class="input">
284 230 ${h.text('new_email', class_='medium')}
285 231 </div>
286 232 </div>
287 233 <div class="buttons">
288 234 ${h.submit('save',_('Add'),class_="ui-btn large")}
289 235 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
290 236 </div>
291 237 </div>
292 238 </div>
293 239 ${h.end_form()}
294 240 </div>
295 241 <div class="box box-left" style="clear:left">
296 242 <!-- box / title -->
297 243 <div class="title">
298 244 <h5>${_('Allowed IP addresses')}</h5>
299 245 </div>
300 246
301 247 <div class="ips_wrap">
302 248 <table class="noborder">
303 249 %if c.user_ip_map:
304 250 %for ip in c.user_ip_map:
305 251 <tr>
306 252 <td><div class="ip">${ip.ip_addr}</div></td>
307 253 <td><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
308 254 <td>
309 255 ${h.form(url('user_ips_delete', id=c.user.user_id),method='delete')}
310 256 ${h.hidden('del_ip',ip.ip_id)}
311 257 ${h.submit('remove_',_('delete'),id="remove_ip_%s" % ip.ip_id,
312 258 class_="delete_icon action_button", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
313 259 ${h.end_form()}
314 260 </td>
315 261 </tr>
316 262 %endfor
317 263 %else:
318 264 <tr><td><div class="ip">${_('All IP addresses are allowed')}</div></td></tr>
319 265 %endif
320 266 </table>
321 267 </div>
322 268
323 269 ${h.form(url('user_ips', id=c.user.user_id),method='put')}
324 270 <div class="form">
325 271 <!-- fields -->
326 272 <div class="fields">
327 273 <div class="field">
328 274 <div class="label">
329 275 <label for="new_ip">${_('New ip address')}:</label>
330 276 </div>
331 277 <div class="input">
332 278 ${h.text('new_ip', class_='medium')}
333 279 </div>
334 280 </div>
335 281 <div class="buttons">
336 282 ${h.submit('save',_('Add'),class_="ui-btn large")}
337 283 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
338 284 </div>
339 285 </div>
340 286 </div>
341 287 ${h.end_form()}
342 288 </div>
343 289 </%def>
@@ -1,283 +1,239 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3
4 4 <%def name="title()">
5 5 ${_('My account')} ${c.rhodecode_user.username} &middot; ${c.rhodecode_name}
6 6 </%def>
7 7
8 8 <%def name="breadcrumbs_links()">
9 9 ${_('My Account')}
10 10 </%def>
11 11
12 12 <%def name="page_nav()">
13 13 ${self.menu('admin')}
14 14 </%def>
15 15
16 16 <%def name="main()">
17 17
18 18 <div class="box box-left">
19 19 <!-- box / title -->
20 20 <div class="title">
21 21 ${self.breadcrumbs()}
22 22 </div>
23 23 <!-- end box / title -->
24 24 ${c.form|n}
25 25 </div>
26 26
27 27 <div class="box box-right">
28 28 <!-- box / title -->
29 29 <div class="title">
30 30 <h5>
31 31 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/>
32 32 </h5>
33 33 <ul class="links" style="color:#DADADA">
34 34 <li>
35 35 <span><a id="show_perms" class="link-white current" href="#perms">${_('My permissions')}</a> </span>
36 36 </li>
37 37 <li>
38 38 <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
39 39 </li>
40 40 <li>
41 41 <span><a id="show_pullrequests" class="link-white" href="#pullrequests">${_('My pull requests')}</a> </span>
42 42 </li>
43 43 </ul>
44 44 </div>
45 45 <!-- end box / title -->
46 <div id="perms_container">
47 <div id="perms" class="table">
48 %for section in sorted(c.rhodecode_user.permissions.keys()):
49 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
46 ## permissions overview
47 <%namespace name="p" file="/base/perms_summary.html"/>
48 ${p.perms_summary(c.perm_user.permissions)}
50 49
51 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
52 <table id="tbl_list_${section}">
53 <thead>
54 <tr>
55 <th class="left">${_('Name')}</th>
56 <th class="left">${_('Permission')}</th>
57 </thead>
58 <tbody>
59 %for k in sorted(c.rhodecode_user.permissions[section], key=lambda s: s.lower):
60 <%
61 if section != 'global':
62 section_perm = c.rhodecode_user.permissions[section].get(k)
63 _perm = section_perm.split('.')[-1]
64 else:
65 _perm = section_perm = None
66 %>
67 %if _perm not in ['none']:
68 <tr>
69 <td>
70 %if section == 'repositories':
71 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
72 %elif section == 'repositories_groups':
73 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
74 %else:
75 ${k}
76 %endif
77 </td>
78 <td>
79 %if section == 'global':
80 ${h.boolicon(True)}
81 %else:
82 <span class="perm_tag ${_perm}">${section_perm}</span>
83 %endif
84 </td>
85 </tr>
86 %endif
87 %endfor
88 </tbody>
89 </table>
90 </div>
91 %endfor
92 </div>
93 </div>
94 50 <div id="my_container" style="display:none">
95 51 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
96 52 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
97 53 </div>
98 54 <div id="pullrequests_container" class="table" style="display:none">
99 55 ## loaded via AJAX
100 56 ${_('Loading...')}
101 57 </div>
102 58 </div>
103 59
104 60 <script type="text/javascript">
105 61 pyroutes.register('admin_settings_my_pullrequests', "${url('admin_settings_my_pullrequests')}", []);
106 62
107 63 var show_perms = function(e){
108 64 YUD.addClass('show_perms', 'current');
109 65 YUD.removeClass('show_my','current');
110 66 YUD.removeClass('show_pullrequests','current');
111 67
112 68 YUD.setStyle('my_container','display','none');
113 69 YUD.setStyle('pullrequests_container','display','none');
114 70 YUD.setStyle('perms_container','display','');
115 71 YUD.setStyle('q_filter','display','none');
116 72 }
117 73 YUE.on('show_perms','click',function(e){
118 74 show_perms();
119 75 })
120 76
121 77 var show_my = function(e){
122 78 YUD.addClass('show_my', 'current');
123 79 YUD.removeClass('show_perms','current');
124 80 YUD.removeClass('show_pullrequests','current');
125 81
126 82 YUD.setStyle('perms_container','display','none');
127 83 YUD.setStyle('pullrequests_container','display','none');
128 84 YUD.setStyle('my_container','display','');
129 85 YUD.setStyle('q_filter','display','');
130 86 if(!YUD.hasClass('show_my', 'loaded')){
131 87 table_renderer(${c.data |n});
132 88 YUD.addClass('show_my', 'loaded');
133 89 }
134 90 }
135 91 YUE.on('show_my','click',function(e){
136 92 show_my(e);
137 93 })
138 94
139 95 var show_pullrequests = function(e){
140 96 YUD.addClass('show_pullrequests', 'current');
141 97 YUD.removeClass('show_my','current');
142 98 YUD.removeClass('show_perms','current');
143 99
144 100 YUD.setStyle('my_container','display','none');
145 101 YUD.setStyle('perms_container','display','none');
146 102 YUD.setStyle('pullrequests_container','display','');
147 103 YUD.setStyle('q_filter','display','none');
148 104
149 105 var url = pyroutes.url('admin_settings_my_pullrequests');
150 106 if(YUD.get('show_closed') && YUD.get('show_closed').checked) {
151 107 var url = pyroutes.url('admin_settings_my_pullrequests', {'pr_show_closed': '1'});
152 108 }
153 109 ypjax(url, 'pullrequests_container', function(){
154 110 YUE.on('show_closed','change',function (e) {
155 111 show_pullrequests(e);
156 112 });
157 113 });
158 114 }
159 115 YUE.on('show_pullrequests','click',function(e){
160 116 show_pullrequests(e)
161 117 })
162 118
163 119 var tabs = {
164 120 'perms': show_perms,
165 121 'my': show_my,
166 122 'pullrequests': show_pullrequests
167 123 }
168 124 var url = location.href.split('#');
169 125 if (url[1]) {
170 126 //We have a hash
171 127 var tabHash = url[1];
172 128 var func = tabs[tabHash]
173 129 if (func){
174 130 func();
175 131 }
176 132 }
177 133
178 134 function table_renderer(data){
179 135 var myDataSource = new YAHOO.util.DataSource(data);
180 136 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
181 137
182 138 myDataSource.responseSchema = {
183 139 resultsList: "records",
184 140 fields: [
185 141 {key:"menu"},
186 142 {key:"raw_name"},
187 143 {key:"name"},
188 144 {key:"last_changeset"},
189 145 {key:"action"},
190 146 ]
191 147 };
192 148 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
193 149 // This is the filter function
194 150 var data = res.results || [],
195 151 filtered = [],
196 152 i,l;
197 153
198 154 if (req) {
199 155 req = req.toLowerCase();
200 156 for (i = 0; i<data.length; i++) {
201 157 var pos = data[i].raw_name.toLowerCase().indexOf(req)
202 158 if (pos != -1) {
203 159 filtered.push(data[i]);
204 160 }
205 161 }
206 162 res.results = filtered;
207 163 }
208 164 return res;
209 165 }
210 166
211 167 // main table sorting
212 168 var myColumnDefs = [
213 169 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
214 170 {key:"name",label:"${_('Name')}",sortable:true,
215 171 sortOptions: { sortFunction: nameSort }},
216 172 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
217 173 sortOptions: { sortFunction: revisionSort }},
218 174 {key:"action",label:"${_('Action')}",sortable:false},
219 175 ];
220 176
221 177 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
222 178 sortedBy:{key:"name",dir:"asc"},
223 179 paginator: new YAHOO.widget.Paginator({
224 180 rowsPerPage: 50,
225 181 alwaysVisible: false,
226 182 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
227 183 pageLinks: 5,
228 184 containerClass: 'pagination-wh',
229 185 currentPageClass: 'pager_curpage',
230 186 pageLinkClass: 'pager_link',
231 187 nextPageLinkLabel: '&gt;',
232 188 previousPageLinkLabel: '&lt;',
233 189 firstPageLinkLabel: '&lt;&lt;',
234 190 lastPageLinkLabel: '&gt;&gt;',
235 191 containers:['user-paginator']
236 192 }),
237 193
238 194 MSG_SORTASC:"${_('Click to sort ascending')}",
239 195 MSG_SORTDESC:"${_('Click to sort descending')}",
240 196 MSG_EMPTY:"${_('No records found.')}",
241 197 MSG_ERROR:"${_('Data error.')}",
242 198 MSG_LOADING:"${_('Loading...')}",
243 199 }
244 200 );
245 201 myDataTable.subscribe('postRenderEvent',function(oArgs) {
246 202 tooltip_activate();
247 203 quick_repo_menu();
248 204 });
249 205
250 206 var filterTimeout = null;
251 207
252 208 updateFilter = function() {
253 209 // Reset timeout
254 210 filterTimeout = null;
255 211
256 212 // Reset sort
257 213 var state = myDataTable.getState();
258 214 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
259 215
260 216 // Get filtered data
261 217 myDataSource.sendRequest(YUD.get('q_filter').value,{
262 218 success : myDataTable.onDataReturnInitializeTable,
263 219 failure : myDataTable.onDataReturnInitializeTable,
264 220 scope : myDataTable,
265 221 argument: state
266 222 });
267 223
268 224 };
269 225 YUE.on('q_filter','click',function(){
270 226 if(!YUD.hasClass('q_filter', 'loaded')){
271 227 //TODO: load here full list later to do search within groups
272 228 YUD.addClass('q_filter', 'loaded');
273 229 }
274 230 });
275 231
276 232 YUE.on('q_filter','keyup',function (e) {
277 233 clearTimeout(filterTimeout);
278 234 filterTimeout = setTimeout(updateFilter,600);
279 235 });
280 236
281 237 }
282 238 </script>
283 239 </%def>
@@ -1,228 +1,175 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Edit user group')} ${c.users_group.users_group_name} &middot; ${c.rhodecode_name}
6 6 </%def>
7 7
8 8 <%def name="breadcrumbs_links()">
9 9 ${h.link_to(_('Admin'),h.url('admin_home'))}
10 10 &raquo;
11 11 ${h.link_to(_('UserGroups'),h.url('users_groups'))}
12 12 &raquo;
13 13 ${_('Edit %s') % c.users_group.users_group_name}
14 14 </%def>
15 15
16 16 <%def name="page_nav()">
17 17 ${self.menu('admin')}
18 18 </%def>
19 19
20 20 <%def name="main()">
21 21 <div class="box box-left">
22 22 <!-- box / title -->
23 23 <div class="title">
24 24 ${self.breadcrumbs()}
25 25 </div>
26 26 <!-- end box / title -->
27 27 ${h.form(url('users_group', id=c.users_group.users_group_id),method='put', id='edit_users_group')}
28 28 <div class="form">
29 29 <!-- fields -->
30 30 <div class="fields">
31 31 <div class="field">
32 32 <div class="label">
33 33 <label for="users_group_name">${_('Group name')}:</label>
34 34 </div>
35 35 <div class="input">
36 36 ${h.text('users_group_name',class_='small')}
37 37 </div>
38 38 </div>
39 39
40 40 <div class="field">
41 41 <div class="label label-checkbox">
42 42 <label for="users_group_active">${_('Active')}:</label>
43 43 </div>
44 44 <div class="checkboxes">
45 45 ${h.checkbox('users_group_active',value=True)}
46 46 </div>
47 47 </div>
48 48 <div class="field">
49 49 <div class="label">
50 50 <label for="users_group_active">${_('Members')}:</label>
51 51 </div>
52 52 <div class="select">
53 53 <table>
54 54 <tr>
55 55 <td>
56 56 <div>
57 57 <div style="float:left">
58 58 <div class="text" style="padding: 0px 0px 6px;">${_('Chosen group members')}</div>
59 59 ${h.select('users_group_members',[x[0] for x in c.group_members],c.group_members,multiple=True,size=8,style="min-width:210px")}
60 60 <div id="remove_all_elements" style="cursor:pointer;text-align:center">
61 61 ${_('Remove all elements')}
62 62 <img alt="remove" style="vertical-align:text-bottom" src="${h.url('/images/icons/arrow_right.png')}"/>
63 63 </div>
64 64 </div>
65 65 <div style="float:left;width:20px;padding-top:50px">
66 66 <img alt="add" id="add_element"
67 67 style="padding:2px;cursor:pointer"
68 68 src="${h.url('/images/icons/arrow_left.png')}"/>
69 69 <br />
70 70 <img alt="remove" id="remove_element"
71 71 style="padding:2px;cursor:pointer"
72 72 src="${h.url('/images/icons/arrow_right.png')}"/>
73 73 </div>
74 74 <div style="float:left">
75 75 <div class="text" style="padding: 0px 0px 6px;">${_('Available members')}</div>
76 76 ${h.select('available_members',[],c.available_members,multiple=True,size=8,style="min-width:210px")}
77 77 <div id="add_all_elements" style="cursor:pointer;text-align:center">
78 78 <img alt="add" style="vertical-align:text-bottom" src="${h.url('/images/icons/arrow_left.png')}"/>
79 79 ${_('Add all elements')}
80 80 </div>
81 81 </div>
82 82 </div>
83 83 </td>
84 84 </tr>
85 85 </table>
86 86 </div>
87 87
88 88 </div>
89 89 <div class="buttons">
90 90 ${h.submit('Save',_('Save'),class_="ui-btn large")}
91 91 </div>
92 92 </div>
93 93 </div>
94 94 ${h.end_form()}
95 95 </div>
96 96
97 97 <div class="box box-right">
98 98 <!-- box / title -->
99 99 <div class="title">
100 100 <h5>${_('Permissions')}</h5>
101 101 </div>
102 102 ${h.form(url('users_group_perm', id=c.users_group.users_group_id), method='put')}
103 103 <div class="form">
104 104 <!-- fields -->
105 105 <div class="fields">
106 106 <div class="field">
107 107 <div class="label label-checkbox">
108 108 <label for="inherit_permissions">${_('Inherit default permissions')}:</label>
109 109 </div>
110 110 <div class="checkboxes">
111 111 ${h.checkbox('inherit_default_permissions',value=True)}
112 112 </div>
113 113 <span class="help-block">${h.literal(_('Select to inherit permissions from %s settings. '
114 114 'With this selected below options does not have any action') % h.link_to('default', url('edit_permission', id='default')))}</span>
115 115 </div>
116 116 <div id="inherit_overlay" style="${'opacity:0.3' if c.users_group.inherit_default_permissions else ''}" >
117 117 <div class="field">
118 118 <div class="label label-checkbox">
119 119 <label for="create_repo_perm">${_('Create repositories')}:</label>
120 120 </div>
121 121 <div class="checkboxes">
122 122 ${h.checkbox('create_repo_perm',value=True)}
123 123 </div>
124 124 </div>
125 125 <div class="field">
126 126 <div class="label label-checkbox">
127 127 <label for="fork_repo_perm">${_('Fork repositories')}:</label>
128 128 </div>
129 129 <div class="checkboxes">
130 130 ${h.checkbox('fork_repo_perm',value=True)}
131 131 </div>
132 132 </div>
133 133 </div>
134 134 <div class="buttons">
135 135 ${h.submit('save',_('Save'),class_="ui-btn large")}
136 136 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
137 137 </div>
138 138 </div>
139 139 </div>
140 140 ${h.end_form()}
141
142 ## permissions overview
143 <%namespace name="p" file="/base/perms_summary.html"/>
144 ${p.perms_summary(c.users_group.permissions)}
141 145 </div>
142 146
143 <div class="box box-right">
147 <div class="box box-right" style="clear:right">
144 148 <!-- box / title -->
145 149 <div class="title">
146 150 <h5>${_('Group members')}</h5>
147 151 </div>
148 152
149 153 <div class="group_members_wrap">
150 154 % if c.group_members_obj:
151 155 <ul class="group_members">
152 156 %for user in c.group_members_obj:
153 157 <li>
154 158 <div class="group_member">
155 159 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(user.email,24)}"/> </div>
156 160 <div>${h.link_to(user.username, h.url('edit_user',id=user.user_id))}</div>
157 161 <div>${user.full_name}</div>
158 162 </div>
159 163 </li>
160 164 %endfor
161 165 </ul>
162 166 %else:
163 167 <span class="empty_data">${_('No members yet')}</span>
164 168 %endif
165 169 </div>
166 170 </div>
167 171
168 <div class="box box-left">
169 <!-- box / title -->
170 <div class="title">
171 <h5>${_('Permissions defined for this group')}</h5>
172 </div>
173 ## permissions overview
174 <div id="perms" class="table">
175 %for section in sorted(c.users_group.permissions.keys()):
176 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
177 %if not c.users_group.permissions:
178 <span class="empty_data">${_('No permissions set yet')}</span>
179 %else:
180 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
181 <table id="tbl_list_repository">
182 <thead>
183 <tr>
184 <th class="left">${_('Name')}</th>
185 <th class="left">${_('Permission')}</th>
186 <th class="left">${_('Edit Permission')}</th>
187 </thead>
188 <tbody>
189 %for k in sorted(c.users_group.permissions[section], key=lambda s: s.lower):
190 <%
191 section_perm = c.users_group.permissions[section].get(k)
192 _perm = section_perm.split('.')[-1]
193 %>
194 <tr>
195 <td>
196 %if section == 'repositories':
197 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
198 %elif section == 'repositories_groups':
199 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
200 %endif
201 </td>
202 <td>
203 <span class="perm_tag ${_perm}">${section_perm}</span>
204 </td>
205 <td>
206 %if section == 'repositories':
207 <a href="${h.url('edit_repo',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
208 %elif section == 'repositories_groups':
209 <a href="${h.url('edit_repos_group',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
210 %else:
211 --
212 %endif
213 </td>
214 </tr>
215 %endfor
216 </tbody>
217 </table>
218 </div>
219 %endif
220 %endfor
221 </div>
222 </div>
223
224
225 172 <script type="text/javascript">
226 173 MultiSelectWidget('users_group_members','available_members','edit_users_group');
227 174 </script>
228 175 </%def>
General Comments 0
You need to be logged in to leave comments. Login now