* Admin: allow to show last login, IP and password change in list

This commit is contained in:
Ralf Becker 2018-06-01 14:46:52 +02:00
parent 49e2597568
commit 84b715c5af
3 changed files with 17 additions and 2 deletions

View File

@ -58,7 +58,7 @@ class admin_ui
'order' => 'account_lid',
'sort' => 'ASC',
'row_id' => 'account_id',
'default_cols' => '!account_id,created',
'default_cols' => '!account_id,created,account_lastlogin,account_lastloginfrom,account_lastpwd_change',
'actions' => self::user_actions(),
'placeholder_actions' => array('add')
);

View File

@ -17,6 +17,9 @@
<column width="90"/>
<column width="120"/>
<column width="120"/>
<column width="120"/>
<column width="120"/>
<column width="120"/>
</columns>
<rows>
<row>
@ -29,6 +32,9 @@
<nextmatch-sortheader label="Expires" id="account_expires"/>
<nextmatch-sortheader label="Created" id="created"/>
<nextmatch-sortheader label="Last modified" id="modified"/>
<nextmatch-sortheader label="Last login" id="account_lastlogin"/>
<nextmatch-sortheader label="Last IP" id="account_lastloginfrom"/>
<nextmatch-sortheader label="Last password change" id="account_lastpwd_change"/>
</row>
<row class="$row_cont[status_class]">
<description id="${row}[account_lid]" no_lang="1"/>
@ -42,6 +48,9 @@
<description id="${row}[status]" no_lang="1" class="adminStatus"/>
<date-time id="${row}[account_created]" readonly="true"/>
<date-time id="${row}[account_modified]" readonly="true"/>
<date-time id="${row}[account_lastlogin]" readonly="true"/>
<description id="${row}[account_lastloginfrom]" no_lang="1"/>
<date-time id="${row}[account_lastpwd_change]" readonly="true"/>
</row>
</rows>
</grid>

View File

@ -533,7 +533,8 @@ class Sql
$accounts = array();
foreach((array) $this->contacts->search($criteria,
array_merge(array(1,'n_given','n_family','id','created','modified',$this->table.'.account_id AS account_id'),$email_cols),
$order,"account_lid,account_type,account_status,account_expires,account_primary_group,account_description",
$order, "account_lid,account_type,account_status,account_expires,account_primary_group,account_description".
",account_lastlogin,account_lastloginfrom,account_lastpwd_change",
$wildcard,false,$query[0] == '!' ? 'AND' : 'OR',
$param['offset'] ? array($param['start'], $param['offset']) : (is_null($param['start']) ? false : $param['start']),
$filter,$join) as $contact)
@ -555,6 +556,11 @@ class Sql
// Api\Contacts::search() returns everything in user-time, need to convert to server-time
'account_created' => Api\DateTime::user2server($contact['created']),
'account_modified' => Api\DateTime::user2server($contact['modified']),
'account_lastlogin' => $contact['account_lastlogin'] ?
Api\DateTime::user2server($contact['account_lastlogin']) : null,
'account_lastloginfrom' => $contact['account_lastloginfrom'],
'account_lastpwd_change' => $contact['account_lastpwd_change'] ?
Api\DateTime::user2server($contact['account_lastpwd_change']) : null,
'account_description' => $contact['account_description'],
);
}