Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • fusiondirectory-orchestrator fusiondirectory-orchestrator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 25
    • Issues 25
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • fusiondirectoryfusiondirectory
  • fusiondirectory-orchestratorfusiondirectory-orchestrator
  • Merge requests
  • !88

Resolve "[Orchestrator] - Update audit tasks to allows generation of syslog export data"

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged dockx thibault requested to merge 77-orchestrator-update-audit-tasks-to-allows-generation-of-syslog-export-data into dev 1 month ago
  • Overview 0
  • Commits 5
  • Pipelines 6
  • Changes 1

Related to #77 (closed)

Viewing commit c7847464
Next
Show latest version
1 file
+ 51
− 6

    Preferences

    File browser
    Compare changes
  • Verified
    c7847464
    dockx thibault
    :art: feat(audit) - enhance Audit class to support syslog audits and improve array filtering · c7847464
    dockx thibault authored 1 month ago
plugins/tasks/Audit.php
+ 51
− 6
  • View file @ c7847464

  • Edit in single-file editor

  • Open in Web IDE


@@ -2,14 +2,11 @@
class Audit implements EndpointInterface
{
private TaskGateway $gateway;
private Utils $utils;
public function __construct (TaskGateway $gateway)
{
$this->gateway = $gateway;
$this->utils = new Utils();
}
/**
@@ -46,15 +43,28 @@ class Audit implements EndpointInterface
*/
public function processEndPointPatch (array $data = NULL): array
{
$result = $this->processAuditDeletion($this->gateway->getObjectTypeTask('Audit'));
// Check if audit type is specified in data
$auditType = $data['type'] ?? 'standard'; // Default to standard audit
if ($auditType === 'syslog') {
// Process syslog audit
$result = $this->processSyslogAuditTransformation($this->gateway->getObjectTypeTask('Audit-Syslog'));
} else {
// Process standard audit
$result = $this->processAuditDeletion($this->gateway->getObjectTypeTask('Audit'));
}
// Recursive function to filter out empty arrays at any depth
$nonEmptyResults = $this->utils->recursiveArrayFilter($result);
$nonEmptyResults = $this->recursiveArrayFilter($result);
if (!empty($nonEmptyResults)) {
return $nonEmptyResults;
} else {
return ['No audit requiring removal'];
if ($auditType === 'syslog') {
return ['No syslog audit entries requiring removal'];
} else {
return ['No standard audit entries requiring removal'];
}
}
}
@@ -85,6 +95,26 @@ class Audit implements EndpointInterface
return $result;
}
/**
* @param array $syslogAuditSubTasks
* @return array
* @throws Exception
*/
public function processSyslogAuditTransformation (array $syslogAuditSubTasks): array
{
$result = [];
print_r($syslogAuditSubTasks);
exit;
foreach ($syslogAuditSubTasks as $task) {
// Similar to processAuditDeletion but for syslog
// ...
}
return $result;
}
/**
* @param string $mainTaskDn
* @return array
@@ -121,4 +151,19 @@ class Audit implements EndpointInterface
return $audit;
}
/**
* @param array $array
* @return array
* Note : Recursively filters out empty values and arrays at any depth.
*/
public function recursiveArrayFilter (array $array): array
{
return array_filter($array, function ($item) {
if (is_array($item)) {
$item = $this->recursiveArrayFilter($item);
}
return !empty($item);
});
}
}
\ No newline at end of file
Assignee
dockx thibault's avatar
dockx thibault
Assign to
0 Reviewers
None
Request review from
Labels
3
Added PJ1802-0188 gendarmerie
3
Added PJ1802-0188 gendarmerie
    Assign labels
  • Manage project labels

Milestone
FusionDirectory Orchestrator 1.2
FusionDirectory Orchestrator 1.2 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 Participant
dockx thibault
Reference: fusiondirectory/fusiondirectory-orchestrator!88
Source branch: 77-orchestrator-update-audit-tasks-to-allows-generation-of-syslog-export-data

Menu

Explore Projects Groups Topics Snippets