show user session stats
all roles having read-user-stats enabled can show a list of user sessions (last login, creation times, and active flag) to find unused accounts which could be deactivated.
This commit is contained in:
@@ -58,3 +58,6 @@ msgstr "Dienstplan"
|
||||
msgid "preview"
|
||||
msgstr "Vorschau"
|
||||
|
||||
msgid "user-stats"
|
||||
msgstr "Nutzeraktivität"
|
||||
|
||||
|
||||
@@ -31,3 +31,30 @@ msgstr "letzte Änderung"
|
||||
msgid "label_score"
|
||||
msgstr "Punkte"
|
||||
|
||||
msgid "label_login"
|
||||
msgstr "Login"
|
||||
|
||||
msgid "label_full_name"
|
||||
msgstr "Name"
|
||||
|
||||
msgid "label_last_login"
|
||||
msgstr "letztes Login"
|
||||
|
||||
msgid "label_login_count"
|
||||
msgstr "Anzahl Logins"
|
||||
|
||||
msgid "label_disabled"
|
||||
msgstr "gesperrt"
|
||||
|
||||
msgid "label_created_at"
|
||||
msgstr "erstellt am"
|
||||
|
||||
msgid "label_created_by"
|
||||
msgstr "erstellt von"
|
||||
|
||||
msgid "button_show_active_users"
|
||||
msgstr "aktive Nutzer"
|
||||
|
||||
msgid "button_show_user_stats"
|
||||
msgstr "Nutzerstatistik"
|
||||
|
||||
|
||||
@@ -58,3 +58,6 @@ msgstr "Schedule"
|
||||
msgid "preview"
|
||||
msgstr "Preview"
|
||||
|
||||
msgid "user-stats"
|
||||
msgstr "User Stats"
|
||||
|
||||
|
||||
@@ -31,3 +31,30 @@ msgstr "last modified at"
|
||||
msgid "label_score"
|
||||
msgstr "Score"
|
||||
|
||||
msgid "label_login"
|
||||
msgstr "Login"
|
||||
|
||||
msgid "label_full_name"
|
||||
msgstr "Name"
|
||||
|
||||
msgid "label_last_login"
|
||||
msgstr "last login date"
|
||||
|
||||
msgid "label_login_count"
|
||||
msgstr "login counts"
|
||||
|
||||
msgid "label_disabled"
|
||||
msgstr "disabled"
|
||||
|
||||
msgid "label_created_at"
|
||||
msgstr "created at"
|
||||
|
||||
msgid "label_created_by"
|
||||
msgstr "created by"
|
||||
|
||||
msgid "button_show_active_users"
|
||||
msgstr "active users"
|
||||
|
||||
msgid "button_show_user_stats"
|
||||
msgstr "user stats"
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
<div><a href="image.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>&search=<TMPL_VAR .presets.user>"><i class="fas fa-images"></i> <TMPL_VAR .loc.images></a></div>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF .allow.read_user_stats>
|
||||
<div><a href="user-stats.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>&action=show-user-stats"><i class="fas fa-images"></i> <TMPL_VAR .loc.user-stats></a></div>
|
||||
</TMPL_IF>
|
||||
|
||||
<div title="<TMPL_VAR .loc.profile>"><a href="user-settings.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><i class="fas fa-cog"></i> <TMPL_VAR .loc.profile></a></div>
|
||||
|
||||
<div title="<TMPL_VAR .loc.help>"><a href="help.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><i class="fas fa-info"></i> <TMPL_VAR .loc.help></a></div>
|
||||
|
||||
67
website/agenda/planung/templates/user-active.html
Normal file
67
website/agenda/planung/templates/user-active.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<script src="js/jquery.tablesorter.min.js"></script>
|
||||
<script src="js/jquery.tablesorter.widgets.min.js"></script>
|
||||
<script src="js/jquery.tablesorter.scroller.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(
|
||||
function(){
|
||||
$('table#user_stats_table').tablesorter({
|
||||
widgets: ["filter"],
|
||||
usNumberFormat : false
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
div.col {
|
||||
float:left;
|
||||
width:10px;
|
||||
height:10px;
|
||||
}
|
||||
table#user_stats_table input{
|
||||
max-width:6em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2><TMPL_VAR loc.title></h2>
|
||||
<hr>
|
||||
<TMPL_INCLUDE status.html>
|
||||
|
||||
<button onclick="load('user-stats.cgi?project_id=<TMPL_VAR .project_id>&studio_id=<TMPL_VAR .studio_id>&action=show-user-stats')">
|
||||
<TMPL_VAR .loc.button_show_user_stats>
|
||||
</button>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" name="project_id" value="<TMPL_VAR project_id>">
|
||||
<input type="hidden" name="studio_id" value="<TMPL_VAR studio_id>">
|
||||
</form>
|
||||
|
||||
<table id="user_stats_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><TMPL_VAR loc.label_login></th>
|
||||
<th><TMPL_VAR loc.label_full_name></th>
|
||||
<th><TMPL_VAR loc.label_last_login></th>
|
||||
<th><TMPL_VAR loc.label_login_count></th>
|
||||
<th><TMPL_VAR loc.label_disabled></th>
|
||||
<th><TMPL_VAR loc.label_created_at></th>
|
||||
<th><TMPL_VAR loc.label_created_by></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<TMPL_LOOP user_stats>
|
||||
<tr>
|
||||
<td><TMPL_VAR login></td>
|
||||
<td><TMPL_VAR full_name></td>
|
||||
<td><TMPL_VAR last_login></td>
|
||||
<td><TMPL_VAR login_count></td>
|
||||
<td><TMPL_VAR disabled></td>
|
||||
<td><TMPL_VAR created_at></td>
|
||||
<td><TMPL_VAR created_by></td>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -28,6 +28,10 @@ table#user_stats_table input{
|
||||
<hr>
|
||||
<TMPL_INCLUDE status.html>
|
||||
|
||||
<button onclick="load('user-stats.cgi?project_id=<TMPL_VAR .project_id>&studio_id=<TMPL_VAR .studio_id>&action=show-active-users');">
|
||||
<TMPL_VAR .loc.button_show_active_users>
|
||||
</button>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" name="project_id" value="<TMPL_VAR project_id>">
|
||||
<input type="hidden" name="studio_id" value="<TMPL_VAR studio_id>">
|
||||
@@ -36,15 +40,15 @@ table#user_stats_table input{
|
||||
<table id="user_stats_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><TMPL_VAR loc.label_user></td>
|
||||
<th><TMPL_VAR loc.label_score></td>
|
||||
<th><TMPL_VAR loc.label_modified_at></td>
|
||||
<th><TMPL_VAR loc.label_create_events></td>
|
||||
<th><TMPL_VAR loc.label_update_events></td>
|
||||
<th><TMPL_VAR loc.label_delete_events></td>
|
||||
<th><TMPL_VAR loc.label_create_series></td>
|
||||
<th><TMPL_VAR loc.label_update_series></td>
|
||||
<th><TMPL_VAR loc.label_delete_series></td>
|
||||
<th><TMPL_VAR loc.label_user></th>
|
||||
<th><TMPL_VAR loc.label_score></th>
|
||||
<th><TMPL_VAR loc.label_modified_at></th>
|
||||
<th><TMPL_VAR loc.label_create_events></th>
|
||||
<th><TMPL_VAR loc.label_update_events></th>
|
||||
<th><TMPL_VAR loc.label_delete_events></th>
|
||||
<th><TMPL_VAR loc.label_create_series></th>
|
||||
<th><TMPL_VAR loc.label_update_series></th>
|
||||
<th><TMPL_VAR loc.label_delete_series></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -58,9 +58,16 @@ return unless uac::check( $config, $params, $user_presets ) == 1;
|
||||
|
||||
our $errors = [];
|
||||
|
||||
show_stats( $config, $request );
|
||||
if ($params->{action} eq 'show-active-users'){
|
||||
show_active_users($config, $request);
|
||||
return;
|
||||
};
|
||||
if ($params->{action} eq 'show-user-stats'){
|
||||
show_user_stats( $config, $request );
|
||||
return;
|
||||
};
|
||||
|
||||
sub show_stats {
|
||||
sub show_user_stats {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
|
||||
@@ -70,14 +77,38 @@ sub show_stats {
|
||||
uac::permissions_denied('read_user_stats');
|
||||
return;
|
||||
}
|
||||
print STDERR "continue\n";
|
||||
$params->{user_stats} = user_stats::get_stats( $config, $params );
|
||||
$params->{permissions} = $permissions;
|
||||
$params->{errors} = $errors;
|
||||
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'user-stats' } );
|
||||
uac::set_template_permissions( $permissions, $params );
|
||||
template::process( $config, 'print', $params->{template}, $params );
|
||||
my $template = template::check( $config, 'user-stats' );
|
||||
template::process( $config, 'print', $template, $params );
|
||||
}
|
||||
|
||||
sub show_active_users{
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
unless ( $permissions->{read_user_stats} ) {
|
||||
uac::permissions_denied('read_user_stats');
|
||||
return;
|
||||
}
|
||||
my $user_stats = user_stats::get_active_users( $config, $params );
|
||||
for my $user (@$user_stats){
|
||||
$user->{disabled} = $user->{disabled} ? 'x' : '-';
|
||||
}
|
||||
$params->{user_stats} = $user_stats;
|
||||
$params->{permissions} = $permissions;
|
||||
$params->{errors} = $errors;
|
||||
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'user-stats' } );
|
||||
uac::set_template_permissions( $permissions, $params );
|
||||
my $template = template::check( $config, 'user-active' );
|
||||
template::process( $config, 'print', $template, $params );
|
||||
}
|
||||
|
||||
sub check_params {
|
||||
@@ -86,10 +117,12 @@ sub check_params {
|
||||
|
||||
my $checked = {};
|
||||
|
||||
#template
|
||||
my $template = '';
|
||||
$template = template::check( $config, $params->{template}, 'user-stats' );
|
||||
$checked->{template} = $template;
|
||||
$checked->{action} = '';
|
||||
if ( defined $params->{action} ) {
|
||||
if ( $params->{action} =~ /^(show-user-stats|show-active-users)$/ ) {
|
||||
$checked->{action} = $params->{action};
|
||||
}
|
||||
}
|
||||
|
||||
#numeric values
|
||||
for my $param ( 'project_id', 'default_studio_id', 'studio_id', 'series_id' ) {
|
||||
|
||||
Reference in New Issue
Block a user