repo-permissions: add set/un-set of private repository from permissions page....
repo-permissions: add set/un-set of private repository from permissions page. - this adds consistent 1way of controlling all permissiosn from permissions page - properly flushses caches on this change - adds better UX

File last commit:

r4189:021154b4 stable
r4189:021154b4 stable
Show More
repo_edit_permissions.mako
227 lines | 12.5 KiB | application/x-mako | MakoHtmlLexer
/ rhodecode / templates / admin / repos / repo_edit_permissions.mako
templating: use .mako as extensions for template files.
r1282 <%namespace name="base" file="/base/base.mako"/>
<div class="panel panel-default">
<div class="panel-heading">
permissions: rename repository permissions to mention those are access permissions....
r3985 <h3 class="panel-title">${_('Repository Access Permissions')}</h3>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="panel-body">
forms: unified usage of h.secure_form. Make sure we ALWAYS pass in...
r2105 ${h.secure_form(h.route_path('edit_repo_perms', repo_name=c.repo_name), request=request)}
templating: use .mako as extensions for template files.
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>
dan
permissions: unified looks and buttons on permission pages....
r2980 <th class="td-action"></th>
<th class="td-action"></th>
templating: use .mako as extensions for template files.
r1282 </tr>
## USERS
apps: removed deprecated usage of c.repo_info
r2081 %for _user in c.rhodecode_db_repo.permissions():
templating: use .mako as extensions for template files.
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">
hovercacrds: added new tooltips and hovercards to expose certain information for objects shown in UI
r4026 ${base.gravatar(_user.email, 16, user=_user, tooltip=True)}
templating: use .mako as extensions for template files.
r1282 ${h.link_to_user(_user.username)}
%if getattr(_user, 'admin_row', None):
Bartlomiej Wolynczyk
ui: make super admin named consistently across ui.
r4134 (${_('super-admin')})
templating: use .mako as extensions for template files.
r1282 %endif
%if getattr(_user, 'owner_row', None):
(${_('owner')})
%endif
</td>
<td></td>
dan
permissions: unified looks and buttons on permission pages....
r2980 <td class="quick_repo_menu">
permissions: add links to permissions summary for each permission pages
r2976 % if c.rhodecode_user.is_admin:
dan
permissions: unified looks and buttons on permission pages....
r2980 <i class="icon-more"></i>
<div class="menu_items_container" style="display: none;">
<ul class="menu_items">
<li>
${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))}
</li>
</ul>
</div>
permissions: add links to permissions summary for each permission pages
r2976 % endif
</td>
templating: use .mako as extensions for template files.
r1282 </tr>
apps: removed deprecated usage of c.repo_info
r2081 %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private:
templating: use .mako as extensions for template files.
r1282 <tr>
<td colspan="4">
<span class="private_repo_msg">
dan
tooltip: use consistent h.tooltip usage to set tooltips.
r1843 <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong>
templating: use .mako as extensions for template files.
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>
dan
repo-permissions: add set/un-set of private repository from permissions page....
r4189 <td class="td-action">
<span class="tooltip btn btn-link btn-default" onclick="setPrivateRepo(false); return false" title="${_('Private repositories are only visible to people explicitly added as collaborators. Default permissions wont apply')}">
${_('un-set private mode')}
</span>
</td>
dan
permissions: unified looks and buttons on permission pages....
r2980 <td class="quick_repo_menu">
permissions: add links to permissions summary for each permission pages
r2976 % if c.rhodecode_user.is_admin:
dan
permissions: unified looks and buttons on permission pages....
r2980 <i class="icon-more"></i>
<div class="menu_items_container" style="display: none;">
<ul class="menu_items">
<li>
${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))}
</li>
</ul>
</div>
permissions: add links to permissions summary for each permission pages
r2976 % endif
</td>
templating: use .mako as extensions for template files.
r1282 </tr>
%else:
branch-permissions: handle cases for revoking regular permissions when branch permissions are set:...
r2984 <% used_by_n_rules = len(getattr(_user, 'branch_rules', None) or []) %>
templating: use .mako as extensions for template files.
r1282 <tr>
branch-permissions: handle cases for revoking regular permissions when branch permissions are set:...
r2984 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none', disabled="disabled" if (used_by_n_rules and _user.username != h.DEFAULT_USER) else None)}</td>
<td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read', disabled="disabled" if (used_by_n_rules and _user.username != h.DEFAULT_USER) else None)}</td>
repo-permissions: moved permissions into pyramid....
r1734 <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>
templating: use .mako as extensions for template files.
r1282 <td class="td-user">
hovercacrds: added new tooltips and hovercards to expose certain information for objects shown in UI
r4026 ${base.gravatar(_user.email, 16, user=_user, tooltip=True)}
templating: use .mako as extensions for template files.
r1282 <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)}
permissions: add links to permissions summary for each permission pages
r2976 %if getattr(_user, 'duplicate_perm', None):
(${_('inactive duplicate')})
%endif
branch-rules forbid removal of permissions assigned.
r2977 %if getattr(_user, 'branch_rules', None):
% if used_by_n_rules == 1:
branch-permissions: handle cases for revoking regular permissions when branch permissions are set:...
r2984 (${_('used by {} branch rule, requires write+ permissions').format(used_by_n_rules)})
branch-rules forbid removal of permissions assigned.
r2977 % else:
branch-permissions: handle cases for revoking regular permissions when branch permissions are set:...
r2984 (${_('used by {} branch rules, requires write+ permissions').format(used_by_n_rules)})
branch-rules forbid removal of permissions assigned.
r2977 % endif
%endif
templating: use .mako as extensions for template files.
r1282 % endif
</span>
</td>
<td class="td-action">
branch-rules forbid removal of permissions assigned.
r2977 %if _user.username != h.DEFAULT_USER and getattr(_user, 'branch_rules', None) is None:
templating: use .mako as extensions for template files.
r1282 <span class="btn btn-link btn-danger revoke_perm"
member="${_user.user_id}" member_type="user">
dan
permissions: unified looks and buttons on permission pages....
r2980 ${_('Remove')}
templating: use .mako as extensions for template files.
r1282 </span>
repository-permissions: enable shortcut to set private mode in permission page.
r3809 %elif _user.username == h.DEFAULT_USER:
dan
repo-permissions: add set/un-set of private repository from permissions page....
r4189 <span class="tooltip btn btn-link btn-default" onclick="setPrivateRepo(true); return false" title="${_('Private repositories are only visible to people explicitly added as collaborators. Default permissions wont apply')}">
repository-permissions: enable shortcut to set private mode in permission page.
r3809 ${_('set private mode')}
</span>
templating: use .mako as extensions for template files.
r1282 %endif
</td>
dan
permissions: unified looks and buttons on permission pages....
r2980 <td class="quick_repo_menu">
permissions: add links to permissions summary for each permission pages
r2976 % if c.rhodecode_user.is_admin:
dan
permissions: unified looks and buttons on permission pages....
r2980 <i class="icon-more"></i>
<div class="menu_items_container" style="display: none;">
<ul class="menu_items">
<li>
% 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
</li>
</ul>
</div>
permissions: add links to permissions summary for each permission pages
r2976 % endif
</td>
templating: use .mako as extensions for template files.
r1282 </tr>
%endif
%endfor
## USER GROUPS
permissions: show user group count in permissions summary, and unified some text labels.
r3385 %for _user_group in c.rhodecode_db_repo.permission_user_groups(with_members=True):
templating: use .mako as extensions for template files.
r1282 <tr>
repo-permissions: moved permissions into pyramid....
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>
templating: use .mako as extensions for template files.
r1282 <td class="td-componentname">
hovercacrds: added new tooltips and hovercards to expose certain information for objects shown in UI
r4026 ${base.user_group_icon(_user_group, tooltip=True)}
auth: reduced usage of raw auth calls inside templates
r3587 %if c.is_super_admin:
user-groups: rewrote the app to pyramid...
r2068 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
templating: use .mako as extensions for template files.
r1282 ${_user_group.users_group_name}
</a>
%else:
Bartłomiej Wołyńczyk
Public user group profile Task #5326
r2638 ${h.link_to_group(_user_group.users_group_name)}
templating: use .mako as extensions for template files.
r1282 %endif
permissions: show user group count in permissions summary, and unified some text labels.
r3385 (${_('members')}: ${len(_user_group.members)})
templating: use .mako as extensions for template files.
r1282 </td>
<td class="td-action">
<span class="btn btn-link btn-danger revoke_perm"
member="${_user_group.users_group_id}" member_type="user_group">
dan
permissions: unified looks and buttons on permission pages....
r2980 ${_('Remove')}
templating: use .mako as extensions for template files.
r1282 </span>
</td>
dan
permissions: unified looks and buttons on permission pages....
r2980 <td class="quick_repo_menu">
permissions: add links to permissions summary for each permission pages
r2976 % if c.rhodecode_user.is_admin:
dan
permissions: unified looks and buttons on permission pages....
r2980 <i class="icon-more"></i>
<div class="menu_items_container" style="display: none;">
<ul class="menu_items">
<li>
${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))}
</li>
</ul>
</div>
permissions: add links to permissions summary for each permission pages
r2976 % endif
</td>
templating: use .mako as extensions for template files.
r1282 </tr>
%endfor
<tr class="new_members" id="add_perm_input"></tr>
branch permissions: added logic to define in UI branch permissions....
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>
permissions: add links to permissions summary for each permission pages
r2976 <td></td>
branch permissions: added logic to define in UI branch permissions....
r2975 </tr>
templating: use .mako as extensions for template files.
r1282 </table>
branch permissions: added logic to define in UI branch permissions....
r2975
templating: use .mako as extensions for template files.
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');
});
dan
permissions: unified looks and buttons on permission pages....
r2980 quick_repo_menu();
repository-permissions: enable shortcut to set private mode in permission page.
r3809
dan
repo-permissions: add set/un-set of private repository from permissions page....
r4189 var setPrivateRepo = function (private) {
repository-permissions: enable shortcut to set private mode in permission page.
r3809 var postData = {
dan
repo-permissions: add set/un-set of private repository from permissions page....
r4189 'csrf_token': CSRF_TOKEN,
'private': private
repository-permissions: enable shortcut to set private mode in permission page.
r3809 };
var success = function(o) {
var defaultUrl = pyroutes.url('edit_repo_perms', {"repo_name": templateContext.repo_name});
window.location = o.redirect_url || defaultUrl;
};
ajaxPOST(
pyroutes.url('edit_repo_perms_set_private', {"repo_name": templateContext.repo_name}),
postData,
success);
}
templating: use .mako as extensions for template files.
r1282 </script>