##// END OF EJS Templates
vcs: Minimal change to expose the shadow repository...
vcs: Minimal change to expose the shadow repository Based on my original research, this was the "minimal" starting point. It shows that three concepts are needed for the "repo_name": * From the security standpoint we think of the shadow repository having the same ACL as the target repository of the pull request. This is because the pull request itself is considered to be a part of the target repository. Out of this thought, the variable "acl_repo_name" is used whenever we want to check permissions or when we need the database configuration of the repository. An alternative name would have been "db_repo_name", but the usage for ACL checking is the most important one. * From the web interaction perspective, we need the URL which was originally used to get to the repository. This is because based on this base URL commands can be identified. Especially for Git this is important, so that the commands are correctly recognized. Since the URL is in the focus, this is called "url_repo_name". * Finally we have to deal with the repository on the file system. This is what the VCS layer deal with normally, so this name is called "vcs_repo_name". The original repository interaction is a special case where all three names are the same. When interacting with a pull request, these three names are typically all different. This change is minimal in a sense that it just makes the interaction with a shadow repository barely work, without checking any special constraints yet. This was the starting point for further work on this topic.

File last commit:

r529:4e68a729 default
r887:175782be default
Show More
users.html
140 lines | 4.5 KiB | text/html | HtmlLexer
project: added all source files and assets
r1 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%def name="title()">
${_('Users 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=""/>
${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="user_count">0</span>
</%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">
<li>
<a href="${h.url('new_user')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
</li>
</ul>
</div>
<div id="repos_list_wrap">
<table id="user_list_table" class="display"></table>
</div>
</div>
<script>
$(document).ready(function() {
var get_datatable_count = function(){
var datatable = $('#user_list_table').dataTable();
var api = datatable.api();
var total = api.page.info().recordsDisplay;
var active = datatable.fnGetFilteredData();
i18n: replaced fragile extraction of JS translations from an _TM variable....
r325 var _text = _gettext("{0} active out of {1} users").format(active, total);
$('#user_count').text(_text);
project: added all source files and assets
r1 };
// custom filter that filters by username OR email
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var query = $('#q_filter').val();
var username = data[1];
var email = data[2];
var first_name = data[3];
var last_name = data[4];
var query_str = username + " " +
email + " " +
first_name + " " +
last_name;
if((query_str).indexOf(query) !== -1){
return true;
}
return false;
}
);
// filtered data plugin
$.fn.dataTableExt.oApi.fnGetFilteredData = function ( oSettings ) {
var res = [];
for ( var i=0, iLen=oSettings.fnRecordsDisplay() ; i<iLen ; i++ ) {
var record = oSettings.aoData[i]._aData;
if(record['active_raw']){
res.push(record);
}
}
return res.length;
};
// user list
$('#user_list_table').DataTable({
data: ${c.data|n},
dom: 'rtp',
pageLength: ${c.visual.admin_grid_items},
order: [[ 1, "asc" ]],
columns: [
{ data: {"_": "username",
"sort": "username_raw"}, title: "${_('Username')}", className: "td-user" },
{ data: {"_": "email",
"sort": "email"}, title: "${_('Email')}", className: "td-email" },
{ data: {"_": "first_name",
"sort": "first_name"}, title: "${_('First Name')}", className: "td-user" },
{ data: {"_": "last_name",
"sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" },
{ data: {"_": "last_login",
"sort": "last_login_raw",
"type": Number}, title: "${_('Last login')}", className: "td-time" },
{ data: {"_": "active",
"sort": "active_raw"}, title: "${_('Active')}", className: "td-active" },
{ data: {"_": "admin",
"sort": "admin_raw"}, title: "${_('Admin')}", className: "td-admin" },
{ data: {"_": "extern_type",
"sort": "extern_type"}, title: "${_('Authentication type')}", className: "td-type" },
{ data: {"_": "action",
"sort": "action"}, title: "${_('Action')}", className: "td-action" }
],
language: {
tables: better message when tables are empty #685 #1832
r492 paginate: DEFAULT_GRID_PAGINATION,
i18n: fixed wrong i18n call in users table.
r529 emptyTable: _gettext("No users available yet.")
project: added all source files and assets
r1 },
"initComplete": function( settings, json ) {
get_datatable_count();
},
"createdRow": function ( row, data, index ) {
if (!data['active_raw']){
$(row).addClass('closed')
}
}
});
// update the counter when doing search
$('#user_list_table').on( 'search.dt', function (e,settings) {
get_datatable_count();
});
// filter, filter both grids
$('#q_filter').on( 'keyup', function () {
var user_api = $('#user_list_table').dataTable().api();
user_api
.draw();
});
// refilter table if page load via back button
$("#q_filter").trigger('keyup');
});
</script>
</%def>