##// END OF EJS Templates
Show admin dropdown for users who are admin of repo groups
marcink -
r3371:199fd214 beta
parent child Browse files
Show More
@@ -401,6 +401,22 b' class AuthUser(object):'
401 return self.admin
401 return self.admin
402
402
403 @property
403 @property
404 def repos_admin(self):
405 """
406 Returns list of repositories you're an admin of
407 """
408 return [x[0] for x in self.permissions['repositories'].iteritems()
409 if x[1] == 'repository.admin']
410
411 @property
412 def groups_admin(self):
413 """
414 Returns list of repositories groups you're an admin of
415 """
416 return [x[0] for x in self.permissions['repositories_groups'].iteritems()
417 if x[1] == 'group.admin']
418
419 @property
404 def ip_allowed(self):
420 def ip_allowed(self):
405 """
421 """
406 Checks if ip_addr used in constructor is allowed from defined list of
422 Checks if ip_addr used in constructor is allowed from defined list of
@@ -23,7 +23,7 b''
23 ${self.breadcrumbs()}
23 ${self.breadcrumbs()}
24 <ul class="links">
24 <ul class="links">
25 <li>
25 <li>
26 <span>${h.link_to(_(u'Add new child group'),h.url('new_repos_group', parent_group=c.repos_group.group_id))}</span>
26 <span>${h.link_to(_(u'Add child group'),h.url('new_repos_group', parent_group=c.repos_group.group_id))}</span>
27 </li>
27 </li>
28 </ul>
28 </ul>
29 </div>
29 </div>
@@ -19,7 +19,9 b''
19 ${self.breadcrumbs()}
19 ${self.breadcrumbs()}
20 <ul class="links">
20 <ul class="links">
21 <li>
21 <li>
22 <span>${h.link_to(_(u'Add new group'),h.url('new_repos_group'))}</span>
22 %if h.HasPermissionAny('hg.admin')():
23 <span>${h.link_to(_(u'Add group'),h.url('new_repos_group'))}</span>
24 %endif
23 </li>
25 </li>
24 </ul>
26 </ul>
25 </div>
27 </div>
@@ -234,24 +234,36 b''
234 %endif
234 %endif
235
235
236 % if h.HasPermissionAll('hg.admin')('access admin main page'):
236 % if h.HasPermissionAll('hg.admin')('access admin main page'):
237 <li>
237 <li>
238 ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
238 ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
239 <%def name="admin_menu()">
239 <%def name="admin_menu()">
240 <ul>
240 <ul>
241 <li>${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}</li>
241 <li>${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}</li>
242 <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
242 <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
243 <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
243 <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
244 <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
244 <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
245 <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
245 <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
246 <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
246 <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
247 <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
247 <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
248 <li>${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}</li>
248 <li>${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}</li>
249 <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>
249 <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>
250 </ul>
250 </ul>
251 </%def>
251 </%def>
252 ## ADMIN MENU
252 ## ADMIN MENU
253 ${admin_menu()}
253 ${admin_menu()}
254 </li>
254 </li>
255 ## if you're a admin of any groups, show admin menu for it
256 % elif c.rhodecode_user.groups_admin:
257 <li>
258 ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
259 <%def name="admin_menu_simple()">
260 <ul>
261 <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
262 </ul>
263 </%def>
264 ## ADMIN MENU
265 ${admin_menu_simple()}
266 </li>
255 % endif
267 % endif
256 </ul>
268 </ul>
257 </li>
269 </li>
@@ -322,7 +334,7 b''
322 <span>${_('Search')}</span>
334 <span>${_('Search')}</span>
323 </a>
335 </a>
324 </li>
336 </li>
325 %if h.HasPermissionAll('hg.admin')('access admin main page'):
337 % if h.HasPermissionAll('hg.admin')('access admin main page'):
326 <li ${is_current('admin')}>
338 <li ${is_current('admin')}>
327 <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}">
339 <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}">
328 <span class="icon">
340 <span class="icon">
@@ -332,7 +344,17 b''
332 </a>
344 </a>
333 ${admin_menu()}
345 ${admin_menu()}
334 </li>
346 </li>
335 %endif
347 % elif c.rhodecode_user.groups_admin:
348 <li ${is_current('admin')}>
349 <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}">
350 <span class="icon">
351 <img src="${h.url('/images/icons/cog_edit.png')}" alt="${_('Admin')}" />
352 </span>
353 <span>${_('Admin')}</span>
354 </a>
355 ${admin_menu_simple()}
356 </li>
357 % endif
336 ${usermenu()}
358 ${usermenu()}
337 %endif
359 %endif
338 <script type="text/javascript">
360 <script type="text/javascript">
General Comments 0
You need to be logged in to leave comments. Login now