##// 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:

r1918:de4c5093 default
r2038:2bdf9d4d default
Show More
auth_settings.mako
116 lines | 3.6 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()">
${_('Authentication Settings')}
%if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}}
%endif
</%def>
<%def name="breadcrumbs_links()">
audit-logs: introduced new view to replace admin journal....
r1758 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
templating: use .mako as extensions for template files.
r1282 &raquo;
${_('Authentication Plugins')}
</%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='admin')}
</%def>
<%def name="main()">
<div class="box">
<div class="title">
${self.breadcrumbs()}
</div>
<div class='sidebar-col-wrapper'>
<div class="sidebar">
<ul class="nav nav-pills nav-stacked">
% for item in resource.get_root().get_nav_list():
<li ${'class=active' if item == resource else ''}>
<a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
</li>
% endfor
</ul>
</div>
<div class="main-content-full-width">
pyramid: if possible fetch csrf tokens from pyramid session....
r1918 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
templating: use .mako as extensions for template files.
r1282 <div class="form">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
</div>
<div class="fields panel-body">
<div class="field">
<div class="label">${_("Enabled Plugins")}</div>
<div class="textarea text-area editor">
${h.textarea('auth_plugins',cols=23,rows=5,class_="medium")}
</div>
<p class="help-block">
${_('Add a list of plugins, separated by commas. '
'The order of the plugins is also the order in which '
'RhodeCode Enterprise will try to authenticate a user.')}
</p>
</div>
<div class="field">
<div class="label">${_('Available Built-in Plugins')}</div>
<ul class="auth_plugins">
%for plugin in available_plugins:
<li>
<div class="auth_buttons">
<span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
${_('enabled') if plugin.get_id() in enabled_plugins else _('disabled')}
</span>
${plugin.get_display_name()} (${plugin.get_id()})
</div>
</li>
%endfor
</ul>
</div>
<div class="buttons">
${h.submit('save',_('Save'),class_="btn")}
</div>
</div>
</div>
</div>
${h.end_form()}
</div>
</div>
</div>
<script>
$('.toggle-plugin').click(function(e){
var auth_plugins_input = $('#auth_plugins');
var notEmpty = function(element, index, array) {
return (element != "");
html: fixed found syntax problems
r1283 };
templating: use .mako as extensions for template files.
r1282 var elems = auth_plugins_input.val().split(',').filter(notEmpty);
var cur_button = e.currentTarget;
var plugin_id = $(cur_button).attr('plugin_id');
if($(cur_button).hasClass('btn-success')){
elems.splice(elems.indexOf(plugin_id), 1);
auth_plugins_input.val(elems.join(','));
$(cur_button).removeClass('btn-success');
cur_button.innerHTML = _gettext('disabled');
}
else{
if(elems.indexOf(plugin_id) == -1){
elems.push(plugin_id);
}
auth_plugins_input.val(elems.join(','));
$(cur_button).addClass('btn-success');
cur_button.innerHTML = _gettext('enabled');
}
});
</script>
</%def>