repo_edit_permissions.mako
172 lines
| 9.3 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | <%namespace name="base" file="/base/base.mako"/> | |||
<div class="panel panel-default"> | ||||
<div class="panel-heading"> | ||||
<h3 class="panel-title">${_('Repository Permissions')}</h3> | ||||
</div> | ||||
<div class="panel-body"> | ||||
r2105 | ${h.secure_form(h.route_path('edit_repo_perms', repo_name=c.repo_name), request=request)} | |||
r1282 | <table id="permissions_manage" class="rctable permissions"> | |||
<tr> | ||||
<th class="td-radio">${_('None')}</th> | ||||
<th class="td-radio">${_('Read')}</th> | ||||
<th class="td-radio">${_('Write')}</th> | ||||
<th class="td-radio">${_('Admin')}</th> | ||||
<th class="td-owner">${_('User/User Group')}</th> | ||||
<th></th> | ||||
r2976 | <th></th> | |||
r1282 | </tr> | |||
## USERS | ||||
r2081 | %for _user in c.rhodecode_db_repo.permissions(): | |||
r1282 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): | |||
<tr class="perm_admin_row"> | ||||
<td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> | ||||
<td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td> | ||||
<td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td> | ||||
<td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td> | ||||
<td class="td-user"> | ||||
${base.gravatar(_user.email, 16)} | ||||
${h.link_to_user(_user.username)} | ||||
%if getattr(_user, 'admin_row', None): | ||||
(${_('super admin')}) | ||||
%endif | ||||
%if getattr(_user, 'owner_row', None): | ||||
(${_('owner')}) | ||||
%endif | ||||
</td> | ||||
<td></td> | ||||
r2976 | <td> | |||
% if c.rhodecode_user.is_admin: | ||||
${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | ||||
% endif | ||||
</td> | ||||
r1282 | </tr> | |||
r2081 | %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private: | |||
r1282 | <tr> | |||
<td colspan="4"> | ||||
<span class="private_repo_msg"> | ||||
r1843 | <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong> | |||
r1282 | </span> | |||
</td> | ||||
<td class="private_repo_msg"> | ||||
${base.gravatar(h.DEFAULT_USER_EMAIL, 16)} | ||||
${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td> | ||||
<td></td> | ||||
r2976 | <td> | |||
% if c.rhodecode_user.is_admin: | ||||
${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | ||||
% endif | ||||
</td> | ||||
r1282 | </tr> | |||
%else: | ||||
<tr> | ||||
r1734 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none')}</td> | |||
<td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read')}</td> | ||||
<td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.write', checked=_user.permission=='repository.write')}</td> | ||||
<td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.admin', checked=_user.permission=='repository.admin')}</td> | ||||
r1282 | <td class="td-user"> | |||
${base.gravatar(_user.email, 16)} | ||||
<span class="user"> | ||||
% if _user.username == h.DEFAULT_USER: | ||||
${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | ||||
% else: | ||||
${h.link_to_user(_user.username)} | ||||
r2976 | %if getattr(_user, 'duplicate_perm', None): | |||
(${_('inactive duplicate')}) | ||||
%endif | ||||
r2977 | %if getattr(_user, 'branch_rules', None): | |||
<% used_by_n_rules = len(_user.branch_rules) %> | ||||
% if used_by_n_rules == 1: | ||||
(${_('used by {} branch rule').format(used_by_n_rules)}) | ||||
% else: | ||||
(${_('used by {} branch rules').format(used_by_n_rules)}) | ||||
% endif | ||||
%endif | ||||
r1282 | % endif | |||
</span> | ||||
</td> | ||||
<td class="td-action"> | ||||
r2977 | %if _user.username != h.DEFAULT_USER and getattr(_user, 'branch_rules', None) is None: | |||
r1282 | <span class="btn btn-link btn-danger revoke_perm" | |||
member="${_user.user_id}" member_type="user"> | ||||
r2975 | ${_('Revoke')} | |||
r1282 | </span> | |||
%endif | ||||
</td> | ||||
r2976 | <td> | |||
% if c.rhodecode_user.is_admin: | ||||
% if _user.username == h.DEFAULT_USER: | ||||
${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | ||||
% else: | ||||
${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | ||||
% endif | ||||
% endif | ||||
</td> | ||||
r1282 | </tr> | |||
%endif | ||||
%endfor | ||||
## USER GROUPS | ||||
r2081 | %for _user_group in c.rhodecode_db_repo.permission_user_groups(): | |||
r1282 | <tr> | |||
r1734 | <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}</td> | |||
<td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.read', checked=_user_group.permission=='repository.read')}</td> | ||||
<td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.write', checked=_user_group.permission=='repository.write')}</td> | ||||
<td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.admin', checked=_user_group.permission=='repository.admin')}</td> | ||||
r1282 | <td class="td-componentname"> | |||
r2975 | <i class="icon-user-group"></i> | |||
r1282 | %if h.HasPermissionAny('hg.admin')(): | |||
r2068 | <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}"> | |||
r1282 | ${_user_group.users_group_name} | |||
</a> | ||||
%else: | ||||
Bartłomiej Wołyńczyk
|
r2638 | ${h.link_to_group(_user_group.users_group_name)} | ||
r1282 | %endif | |||
</td> | ||||
<td class="td-action"> | ||||
<span class="btn btn-link btn-danger revoke_perm" | ||||
member="${_user_group.users_group_id}" member_type="user_group"> | ||||
r2975 | ${_('Revoke')} | |||
r1282 | </span> | |||
</td> | ||||
r2976 | <td> | |||
% if c.rhodecode_user.is_admin: | ||||
${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))} | ||||
% endif | ||||
</td> | ||||
r1282 | </tr> | |||
%endfor | ||||
<tr class="new_members" id="add_perm_input"></tr> | ||||
r2975 | ||||
<tr> | ||||
<td></td> | ||||
<td></td> | ||||
<td></td> | ||||
<td></td> | ||||
<td></td> | ||||
<td> | ||||
<span id="add_perm" class="link"> | ||||
${_('Add user/user group')} | ||||
</span> | ||||
</td> | ||||
r2976 | <td></td> | |||
r2975 | </tr> | |||
r1282 | </table> | |||
r2975 | ||||
r1282 | <div class="buttons"> | |||
${h.submit('save',_('Save'),class_="btn btn-primary")} | ||||
${h.reset('reset',_('Reset'),class_="btn btn-danger")} | ||||
</div> | ||||
${h.end_form()} | ||||
</div> | ||||
</div> | ||||
<script type="text/javascript"> | ||||
$('#add_perm').on('click', function(e){ | ||||
addNewPermInput($(this), 'repository'); | ||||
}); | ||||
$('.revoke_perm').on('click', function(e){ | ||||
markRevokePermInput($(this), 'repository'); | ||||
}); | ||||
</script> | ||||