##// END OF EJS Templates
goto-switcher: optimized performance and query capabilities....
goto-switcher: optimized performance and query capabilities. - Previous implementation had on significant bug. The use of LIMIT 20 was limiting results BEFORE auth checks. In case of large ammount of similarly named repositories user didn't had access too, the result goto search was empty. This was becuase first 20 items fetched didn't pass permission checks and final auth list was empty. To fix this we now use proper filtering for auth using SQL. It means we first check user allowed repositories, and add this as a filter so end result from database is already to only the accessible repositories.

File last commit:

r1980:f55ac84b default
r2038:2bdf9d4d default
Show More
user_groups.mako
108 lines | 3.4 KiB | application/x-mako | MakoHtmlLexer
templating: use .mako as extensions for template files.
r1282 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.mako"/>
<%def name="title()">
${_('User groups administration')}
%if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}
%endif
</%def>
<%def name="breadcrumbs_links()">
<input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
audit-logs: introduced new view to replace admin journal....
r1758 ${h.link_to(_('Admin'),h.route_path('admin_home'))} &raquo; <span id="user_group_count">0</span> ${_('user groups')}
templating: use .mako as extensions for template files.
r1282 </%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='admin')}
</%def>
<%def name="main()">
<div class="box">
<div class="title">
${self.breadcrumbs()}
<ul class="links">
%if h.HasPermissionAny('hg.admin', 'hg.usergroup.create.true')():
<li>
<a href="${h.url('new_users_group')}" class="btn btn-small btn-success">${_(u'Add User Group')}</a>
</li>
%endif
</ul>
</div>
<div id="repos_list_wrap">
<table id="user_group_list_table" class="display"></table>
</div>
</div>
<script>
$(document).ready(function() {
user-groups: moved the display of user group into a pyramid view
r1980 var getDatatableCount = function(){
var table = $('#user_group_list_table').dataTable();
var page = table.api().page.info();
var active = page.recordsDisplay;
var total = page.recordsTotal;
templating: use .mako as extensions for template files.
r1282
user-groups: moved the display of user group into a pyramid view
r1980 var _text = _gettext("{0} out of {1} users").format(active, total);
$('#user_group_count').text(_text);
templating: use .mako as extensions for template files.
r1282 };
// user list
$('#user_group_list_table').DataTable({
user-groups: moved the display of user group into a pyramid view
r1980 processing: true,
serverSide: true,
ajax: "${h.route_path('user_groups_data')}",
templating: use .mako as extensions for template files.
r1282 dom: 'rtp',
pageLength: ${c.visual.admin_grid_items},
order: [[ 0, "asc" ]],
columns: [
user-groups: moved the display of user group into a pyramid view
r1980 { data: {"_": "users_group_name",
"sort": "users_group_name"}, title: "${_('Name')}", className: "td-componentname" },
{ data: {"_": "description",
"sort": "description"}, title: "${_('Description')}", className: "td-description" },
templating: use .mako as extensions for template files.
r1282 { data: {"_": "members",
user-groups: moved the display of user group into a pyramid view
r1980 "sort": "members"}, title: "${_('Members')}", className: "td-number" },
user-groups: added info, and new panel to control user group synchronization....
r1600 { data: {"_": "sync",
"sort": "sync"}, title: "${_('Sync')}", className: "td-sync" },
templating: use .mako as extensions for template files.
r1282 { data: {"_": "active",
user-groups: added info, and new panel to control user group synchronization....
r1600 "sort": "active"}, title: "${_('Active')}", className: "td-active" },
templating: use .mako as extensions for template files.
r1282 { data: {"_": "owner",
"sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
{ data: {"_": "action",
user-groups: moved the display of user group into a pyramid view
r1980 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false}
templating: use .mako as extensions for template files.
r1282 ],
language: {
paginate: DEFAULT_GRID_PAGINATION,
user-groups: moved the display of user group into a pyramid view
r1980 sProcessing: _gettext('loading...'),
templating: use .mako as extensions for template files.
r1282 emptyTable: _gettext("No user groups available yet.")
}
});
user-groups: moved the display of user group into a pyramid view
r1980 $('#user_group_list_table').on('xhr.dt', function(e, settings, json, xhr){
$('#user_group_list_table').css('opacity', 1);
});
$('#user_group_list_table').on('preXhr.dt', function(e, settings, data){
$('#user_group_list_table').css('opacity', 0.3);
templating: use .mako as extensions for template files.
r1282 });
user-groups: moved the display of user group into a pyramid view
r1980 // refresh counters on draw
$('#user_group_list_table').on('draw.dt', function(){
getDatatableCount();
templating: use .mako as extensions for template files.
r1282 });
user-groups: moved the display of user group into a pyramid view
r1980 // filter
$('#q_filter').on('keyup',
$.debounce(250, function() {
$('#user_group_list_table').DataTable().search(
$('#q_filter').val()
).draw();
})
);
templating: use .mako as extensions for template files.
r1282
});
</script>
</%def>