Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory-orchestrator
Commits
2f961416
Verified
Commit
2f961416
authored
8 months ago
by
dockx thibault
Browse files
Options
Download
Patches
Plain Diff
Audit - subTasks updates
SubTasks updates
parent
42aa35da
dev
61-orchestrator-lifecycle-array-supann-is-analyzed-with-static-numbering
63-orchestrator-mail-controller-format-of-mail-text-and-signature-are-not-utf8-usage-of-accents-is
70-create-unitests-for-orchestrator
73-orchestrator-create-a-librabry-in-core-orchestrator
78-redesign-audit-class
79-redesign-mail
80-redesign-notifications-class
81-redesign-reminders-class
82-redesign-lifecycle-class
main
revert-55863b23
1.1
2 merge requests
!72
Releasing Fusiondirectory Orchestrator 1.1
,
!56
Resolve "[Orchestrator] - AUDIT - automatic deletion from audit tasks"
Pipeline
#29245
failed with stages
in 2 minutes
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/tasks/Audit.php
+16
-6
plugins/tasks/Audit.php
with
16 additions
and
6 deletions
+16
-6
plugins/tasks/Audit.php
+
16
−
6
View file @
2f961416
...
@@ -99,7 +99,8 @@ class Audit implements EndpointInterface
...
@@ -99,7 +99,8 @@ class Audit implements EndpointInterface
// Simply get the days to retain audit.
// Simply get the days to retain audit.
$auditRetention
=
$auditMainTask
[
0
][
'fdaudittasksretention'
][
0
];
$auditRetention
=
$auditMainTask
[
0
][
'fdaudittasksretention'
][
0
];
$result
[]
=
$this
->
checkAuditPassedRetention
(
$auditRetention
);
// Verification of all audit and their potential removal based on retention days passed, also update subtasks.
$result
[]
=
$this
->
checkAuditPassedRetention
(
$auditRetention
,
$task
[
'dn'
],
$task
[
'cn'
][
0
]);
}
}
}
}
...
@@ -114,14 +115,14 @@ class Audit implements EndpointInterface
...
@@ -114,14 +115,14 @@ class Audit implements EndpointInterface
* Note : This will return a validation of audit log suppression
* Note : This will return a validation of audit log suppression
* @throws Exception
* @throws Exception
*/
*/
public
function
checkAuditPassedRetention
(
$auditRetention
):
array
public
function
checkAuditPassedRetention
(
$auditRetention
,
$subTaskDN
,
$subTaskCN
):
array
{
{
$result
=
[];
$result
=
[];
// Date time object will use the timezone defined in FD, code is in index.php
// Date time object will use the timezone defined in FD, code is in index.php
$today
=
new
DateTime
();
$today
=
new
DateTime
();
// Search in LDAP for audit entries
// Search in LDAP for audit entries
(All entries ! This can be pretty heavy.
$audit
=
$this
->
gateway
->
getLdapTasks
(
'(objectClass=fdAuditEvent)'
,
[
'fdAuditDateTime'
],
''
,
''
);
$audit
=
$this
->
gateway
->
getLdapTasks
(
'(objectClass=fdAuditEvent)'
,
[
'fdAuditDateTime'
],
''
,
''
);
// Remove the count key from the audit array.
// Remove the count key from the audit array.
$this
->
gateway
->
unsetCountKeys
(
$audit
);
$this
->
gateway
->
unsetCountKeys
(
$audit
);
...
@@ -134,10 +135,19 @@ class Audit implements EndpointInterface
...
@@ -134,10 +135,19 @@ class Audit implements EndpointInterface
// Check if the interval is equal or greater than auditRetention setting
// Check if the interval is equal or greater than auditRetention setting
if
(
$interval
->
days
>=
$auditRetention
)
{
if
(
$interval
->
days
>=
$auditRetention
)
{
// If greater, delete the DN audit entry, we reuse removeSubTask method from gateway.
// If greater, delete the DN audit entry, we reuse removeSubTask method from gateway and get ldap response.(bool).
$result
[
$record
[
'dn'
]][
'result'
]
=
$this
->
gateway
->
removeSubTask
(
$record
[
'dn'
]);
$result
[
$subTaskCN
][
'result'
]
=
$this
->
gateway
->
removeSubTask
(
$record
[
'dn'
]);
$result
[
$subTaskCN
][
'info'
]
=
'Audit record removed.'
;
// Update tasks accordingly if LDAP succeeded. TRUE Boolean returned by ldap.
if
(
$result
[
$subTaskCN
][
'result'
])
{
// Update the subtask with the status completed a.k.a "2".
$result
[
$subTaskCN
][
'statusUpdate'
]
=
$this
->
gateway
->
updateTaskStatus
(
$subTaskDN
,
$subTaskCN
,
"2"
);
}
else
{
// Update the task with the LDAP potential error code.
$result
[
$subTaskCN
][
'statusUpdate'
]
=
$this
->
gateway
->
updateTaskStatus
(
$subTaskDN
,
$subTaskCN
,
$result
[
$record
[
'dn'
]][
'result'
]);
}
}
}
}
}
return
$result
;
return
$result
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets