|
|
${h.form(url('edit_repo_perms_update', repo_name=c.repo_name))}
|
|
|
<div class="form">
|
|
|
<div class="form-horizontal">
|
|
|
<div class="form-group">
|
|
|
${h.hidden('repo_private')}
|
|
|
<table id="permissions_manage" class="table table-condensed">
|
|
|
<tr>
|
|
|
<td>${_('None')}</td>
|
|
|
<td>${_('Read')}</td>
|
|
|
<td>${_('Write')}</td>
|
|
|
<td>${_('Admin')}</td>
|
|
|
<td>${_('User/User Group')}</td>
|
|
|
<td></td>
|
|
|
</tr>
|
|
|
## USERS
|
|
|
%for r2p in sorted(c.repo_info.repo_to_perm, key=lambda x: x.user.username != 'default' and x.user.username):
|
|
|
%if r2p.user.username =='default' and c.repo_info.private:
|
|
|
<tr>
|
|
|
<td colspan="4">
|
|
|
<span class="private_repo_msg">
|
|
|
${_('Private Repository')}
|
|
|
</span>
|
|
|
</td>
|
|
|
<td class="private_repo_msg"><i class="icon-user"></i> ${_('Default')}</td>
|
|
|
</tr>
|
|
|
%else:
|
|
|
<tr id="id${id(r2p.user.username)}">
|
|
|
<td>${h.radio('u_perm_%s' % r2p.user.username,'repository.none')}</td>
|
|
|
<td>${h.radio('u_perm_%s' % r2p.user.username,'repository.read')}</td>
|
|
|
<td>${h.radio('u_perm_%s' % r2p.user.username,'repository.write')}</td>
|
|
|
<td>${h.radio('u_perm_%s' % r2p.user.username,'repository.admin')}</td>
|
|
|
<td>
|
|
|
${h.gravatar(r2p.user.email, size=14)}
|
|
|
%if h.HasPermissionAny('hg.admin')() and r2p.user.username != 'default':
|
|
|
<a href="${h.url('edit_user',id=r2p.user.user_id)}">${r2p.user.username}</a>
|
|
|
%else:
|
|
|
${r2p.user.username if r2p.user.username != 'default' else _('Default')}
|
|
|
%endif
|
|
|
</td>
|
|
|
<td>
|
|
|
%if r2p.user.username !='default':
|
|
|
<span class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}', '${r2p.user.username}')">
|
|
|
<i class="icon-minus-circled"></i> ${_('Revoke')}
|
|
|
</span>
|
|
|
%endif
|
|
|
</td>
|
|
|
</tr>
|
|
|
%endif
|
|
|
%endfor
|
|
|
|
|
|
## USER GROUPS
|
|
|
%for g2p in sorted(c.repo_info.users_group_to_perm, key=lambda x:x.users_group.users_group_name):
|
|
|
<tr id="id${id(g2p.users_group.users_group_name)}">
|
|
|
<td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
|
|
|
<td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.read')}</td>
|
|
|
<td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.write')}</td>
|
|
|
<td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.admin')}</td>
|
|
|
<td>
|
|
|
<i class="icon-users"></i>
|
|
|
%if h.HasPermissionAny('hg.admin')():
|
|
|
<a href="${h.url('edit_users_group',id=g2p.users_group.users_group_id)}">${g2p.users_group.users_group_name}</a>
|
|
|
%else:
|
|
|
${g2p.users_group.users_group_name}
|
|
|
%endif
|
|
|
</td>
|
|
|
<td>
|
|
|
<span class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${g2p.users_group.users_group_id}, 'user_group', '${'id%s'%id(g2p.users_group.users_group_name)}', '${g2p.users_group.users_group_name}')">
|
|
|
<i class="icon-minus-circled"></i> ${_('Revoke')}
|
|
|
</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
%endfor
|
|
|
## New entries added by addPermAction here.
|
|
|
<tr class="new_members last_new_member" id="add_perm_input"><td colspan="6"></td></tr>
|
|
|
<tr>
|
|
|
<td colspan="6">
|
|
|
<span id="add_perm">
|
|
|
<i class="icon-plus"></i> ${_('Add new')}
|
|
|
</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
${h.submit('save',_('Save'),class_="btn btn-default")}
|
|
|
${h.reset('reset',_('Reset'),class_="btn btn-default")}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
${h.end_form()}
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
|
|
|
url = ${h.js(h.url('edit_repo_perms_revoke',repo_name=c.repo_name))};
|
|
|
var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
|
|
|
if (confirm(revoke_msg)){
|
|
|
ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
if (!$('#perm_new_member_name').hasClass('error')) {
|
|
|
$('#add_perm_input').hide();
|
|
|
}
|
|
|
$('#add_perm').click(function () {
|
|
|
addPermAction('repository', ${h.js(c.users_array)}, ${h.js(c.user_groups_array)});
|
|
|
});
|
|
|
});
|
|
|
</script>
|
|
|
|