my $self = shift;
my $dbh = $self->dbconnect();
- my $query = qq|SELECT u.id, u.login, cfg.cfg_key, cfg.cfg_value
- FROM auth.user_config cfg
- LEFT JOIN auth."user" u ON (cfg.user_id = u.id)|;
+ my $query = qq|SELECT u.id, u.login, cfg.cfg_key, cfg.cfg_value, s.mtime AS last_action
+
+ FROM auth."user" AS u
+
+ LEFT JOIN auth.user_config AS cfg
+ ON (cfg.user_id = u.id)
+
+ LEFT JOIN auth.session_content AS sc_login
+ ON (sc_login.sess_key = 'login' AND sc_login.sess_value = ('--- ' \|\| u.login \|\| '\n'))
+
+ LEFT JOIN auth.session AS s
+ ON (s.id = sc_login.session_id)
+ |;
my $sth = prepare_execute_query($main::form, $dbh, $query);
my %users;
while (my $ref = $sth->fetchrow_hashref()) {
- $users{$ref->{login}} ||= { 'login' => $ref->{login}, 'id' => $ref->{id} };
+
+ $users{$ref->{login}} ||= {
+ 'login' => $ref->{login},
+ 'id' => $ref->{id},
+ 'last_action' => $ref->{last_action},
+ };
$users{$ref->{login}}->{$ref->{cfg_key}} = $ref->{cfg_value} if (($ref->{cfg_key} ne 'login') && ($ref->{cfg_key} ne 'id'));
}
'Language missing!' => 'Sprache fehlt!',
'Language saved!' => 'Sprache gespeichert!',
'Languages' => 'Sprachen',
+ 'Last Action' => 'Letzte Aktivität',
'Last Article Number' => 'Letzte Artikelnummer',
'Last Cost' => 'Einkaufspreis',
'Last Credit Note Number' => 'Letzte Gutschriftnummer',
'not configured' => 'nicht konfiguriert',
'not delivered' => 'nicht geliefert',
'not executed' => 'nicht ausgeführt',
+ 'not logged in' => 'nicht eingeloggt',
'not transferred in yet' => 'noch nicht eingelagert',
'not transferred out yet' => 'noch nicht ausgelagert',
'not yet executed' => 'Noch nicht ausgeführt',
<th class="listtop">[% 'Language' | $T8 %]</th>
<th class="listtop">[% 'Dataset' | $T8 %]</th>
<th class="listtop">[% 'Host' | $T8 %]</th>
+ <th class="listtop">[% 'Last Action' | $T8 %]</th>
<!-- <th class="listtop">[% 'Driver' | $T8 %]</th> -->
</tr>
<td> [% HTML.escape(row.countrycode) %]</td>
<td> [% HTML.escape(row.dbname) %]</td>
<td> [% IF row.dbhost %][% HTML.escape(row.dbhost) %][% ELSE %]localhost[% END %]</td>
+ <td>
+ [% IF( row.last_action ) %]
+ [% HTML.escape(row.last_action) %]
+ [% ELSE %]
+ [% 'not logged in' | $T8 %]
+ [% END %]</td>
<!-- <td> [% HTML.escape(row.dbdriver) %]</td> -->
</tr>
[% END %]