view rhodecode/templates/admin/repo_groups/repo_group_edit_perms.html @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents
children
line wrap: on
line source

${h.form(url('edit_repo_group_perms', group_name=c.repo_group.group_name),method='put')}
<div class="form">
   <div class="fields">
        <div class="field">
            <table id="permissions_manage" class="noborder">
                <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 c.repo_group.repo_group_to_perm:
                    ##forbid revoking permission from yourself, except if you're an super admin
                    <tr id="id${id(r2p.user.username)}">
                        %if c.rhodecode_user.user_id != r2p.user.user_id or c.rhodecode_user.is_admin:
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.none')}</td>
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.read')}</td>
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.write')}</td>
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.admin')}</td>
                        <td style="white-space: nowrap;">
                            <img class="perm-gravatar" src="${h.gravatar_url(r2p.user.email,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 style="color:#da4f49" class="action_button" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}', '${r2p.user.username}')">
                             <i class="icon-remove"></i> ${_('revoke')}
                            </span>
                          %endif
                        </td>
                        %else:
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.none', disabled="disabled")}</td>
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.read', disabled="disabled")}</td>
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.write', disabled="disabled")}</td>
                        <td>${h.radio('u_perm_%s' % r2p.user.username,'group.admin', disabled="disabled")}</td>
                        <td style="white-space: nowrap;">
                            <img class="perm-gravatar" src="${h.gravatar_url(r2p.user.email,14)}"/>
                            ${r2p.user.username if r2p.user.username != 'default' else _('default')}
                        </td>
                        <td><i class="icon-user"></i> ${_('delegated admin')}</td>
                        %endif
                    </tr>
                %endfor

                ## USER GROUPS
                %for g2p in c.repo_group.users_group_to_perm:
                    <tr id="id${id(g2p.users_group.users_group_name)}">
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.none')}</td>
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.read')}</td>
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.write')}</td>
                        <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.admin')}</td>
                        <td style="white-space: nowrap;">
                            <img class="perm-gravatar" src="${h.url('/images/icons/group.png')}"/>
                            %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 style="color:#da4f49" class="action_button" 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-remove"></i> ${_('revoke')}
                            </span>
                        </td>
                    </tr>
                %endfor

                <%
                _tmpl = h.literal("""' \
                    <td><input type="radio" value="group.none" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
                    <td><input type="radio" value="group.read" checked="checked" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
                    <td><input type="radio" value="group.write" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
                    <td><input type="radio" value="group.admin" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
                    <td class="ac"> \
                        <div class="perm_ac" id="perm_ac_{0}"> \
                            <input class="yui-ac-input" id="perm_new_member_name_{0}" name="perm_new_member_name_{0}" value="" type="text"> \
                            <input id="perm_new_member_type_{0}" name="perm_new_member_type_{0}" value="" type="hidden">  \
                            <div id="perm_container_{0}"></div> \
                        </div> \
                    </td> \
                    <td></td>'""")
                %>
                ## ADD HERE DYNAMICALLY NEW INPUTS FROM THE '_tmpl'
                <tr class="new_members last_new_member" id="add_perm_input"></tr>
                <tr>
                    <td colspan="6">
                        <span id="add_perm" style="cursor: pointer;">
                            <i class="icon-plus"></i> ${_('Add new')}
                        </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="6">
                       ${_('apply to children')}:
                       ${h.radio('recursive', 'none', label=_('None'), checked="checked")}
                       ${h.radio('recursive', 'groups', label=_('Repository Groups'))}
                       ${h.radio('recursive', 'repos', label=_('Repositories'))}
                       ${h.radio('recursive', 'all', label=_('Both'))}
                       <span class="help-block">${_('Set or revoke permission to all children of that group, including non-private repositories and other groups if selected.')}</span>
                    </td>
                </tr>
            </table>
        </div>
        <div class="buttons">
          ${h.submit('save',_('Save'),class_="btn")}
          ${h.reset('reset',_('Reset'),class_="btn")}
        </div>
   </div>
</div>
${h.end_form()}

<script type="text/javascript">
    function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
        url = "${h.url('edit_repo_group_perms', group_name=c.repo_group.group_name)}";
        var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
        if (confirm(revoke_msg)){
            var recursive = $('input[name=recursive]:checked').val();
            ajaxActionRevokePermission(url, obj_id, obj_type, field_id, {recursive:recursive});
        }
    };

    YUE.onDOMReady(function () {
        if (!YUD.hasClass('perm_new_member_name', 'error')) {
            YUD.setStyle('add_perm_input', 'display', 'none');
        }
        YAHOO.util.Event.addListener('add_perm', 'click', function () {
            addPermAction(${_tmpl}, ${c.users_array|n}, ${c.user_groups_array|n});
        });
    });
</script>