Verified Commit 25d01c7c authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(audit) Improve audit security user tab

Improve display and selection filter for audit events in the security
 user tab

issue #6010
parent 6d782be9
......@@ -42,8 +42,35 @@ class AuditLogAttribute extends OrderedArrayAttribute
} catch (Exception $e) {
$time = $event['fdAuditDateTime'];
}
switch ($event['fdAuditAction']) {
case 'security':
if ($event['fdAuditObjectType'] == 'login') {
$name = _('Sign in');
} elseif ($event['fdAuditObjectType'] == 'logout') {
$name = _('Sign out');
} else {
$name = $event['fdAuditObjectType'];
}
break;
case 'modify':
if (in_array('userPassword', $event['fdAuditAttributes'])) {
$name = _('Password modification');
} else {
$name = sprintf(_('Account modification (%s)'), implode(',', $event['fdAuditAttributes']));
}
break;
case 'create':
case 'remove':
case 'copy':
case 'snapshot':
case 'view':
case 'debug':
default:
$name = $event['fdAuditAction'].' '.$event['fdAuditObjectType'];
break;
}
return [
$event['fdAuditObjectType'],
$name,
$author,
$event['fdAuditAuthorIP'] ?? '',
$time,
......
......@@ -63,6 +63,7 @@ class auditSecurity extends simplePlugin
$events = objects::ls(
'auditEvent',
[
'fdAuditAction' => 1,
'fdAuditDateTime' => 1,
'fdAuditAuthorDN' => 1,
'fdAuditAuthorIP' => 1,
......@@ -72,7 +73,20 @@ class auditSecurity extends simplePlugin
'fdAuditResult' => 1
],
NULL,
'(&(|(fdAuditAction=security)(fdAuditAttributes=userPassword))(|(fdAuditObject='.$this->getUid().')(fdAuditObject='.$this->dn.')(fdAuditAuthorDN='.$this->dn.')))'
'(|'.
'(&'.
'(fdAuditAction=security)'.
'(|'.
'(fdAuditObject='.ldap_escape_f($this->getUid()).')'.
'(fdAuditObject='.ldap_escape_f($this->dn).')'.
'(fdAuditAuthorDN='.ldap_escape_f($this->dn).')'.
')'.
')'.
'(&'.
'(fdAuditAttributes=userPassword)'.
'(fdAuditObject='.ldap_escape_f($this->dn).')'.
')'.
')'
);
uasort(
$events,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment