Commit 868efe45 authored by Côme Chilliet's avatar Côme Chilliet

🚑 fix(audit) Add a random ID to have smaller DNs for audit events

issue #5825
parent c6678990
<?php <?php
/* /*
This code is part of FusionDirectory (http://www.fusiondirectory.org) This code is part of FusionDirectory (http://www.fusiondirectory.org)
Copyright (C) 2015-2016 FusionDirectory Copyright (C) 2015-2018 FusionDirectory
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -75,6 +75,7 @@ class auditEvent extends simplePlugin ...@@ -75,6 +75,7 @@ class auditEvent extends simplePlugin
'main' => array( 'main' => array(
'name' => _('Event'), 'name' => _('Event'),
'attrs' => array( 'attrs' => array(
new HiddenAttribute ('fdAuditId'),
new GeneralizedTimeDisplayAttribute( new GeneralizedTimeDisplayAttribute(
_('Time'), _('Date and time this event happened'), _('Time'), _('Date and time this event happened'),
'fdAuditDateTime', TRUE 'fdAuditDateTime', TRUE
...@@ -90,6 +91,12 @@ class auditEvent extends simplePlugin ...@@ -90,6 +91,12 @@ class auditEvent extends simplePlugin
); );
} }
function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE, $attributesInfo = NULL)
{
parent::__construct($dn, $object, $parent, $mainTab, $attributesInfo);
$this->fdAuditId = mt_rand();
}
function compute_dn() function compute_dn()
{ {
return $this->create_unique_dn('fdAuditDateTime', get_ou('auditRDN').$this->base); return $this->create_unique_dn('fdAuditDateTime', get_ou('auditRDN').$this->base);
......
...@@ -51,9 +51,15 @@ attributetype ( 1.3.6.1.4.1.38414.60.1.7 NAME 'fdAuditResult' ...@@ -51,9 +51,15 @@ attributetype ( 1.3.6.1.4.1.38414.60.1.7 NAME 'fdAuditResult'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE ) SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.60.1.8 NAME 'fdAuditId'
DESC 'FusionDirectory - Random int to be used in the DN'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE)
# Object Class # Object Class
objectclass (1.3.6.1.4.1.38414.60.2.1 NAME 'fdAuditEvent' objectclass (1.3.6.1.4.1.38414.60.2.1 NAME 'fdAuditEvent'
DESC 'FusionDirectory - audit event' DESC 'FusionDirectory - audit event'
MUST ( fdAuditDateTime $ fdAuditAction $ fdAuditAuthorDN $ fdAuditObject $ fdAuditObjectType ) MUST ( fdAuditDateTime $ fdAuditAction $ fdAuditAuthorDN $ fdAuditObject $ fdAuditObjectType )
MAY ( fdAuditAttributes $ fdAuditResult ) ) MAY ( fdAuditAttributes $ fdAuditResult $ fdAuditId ) )
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