Commit ccacddcf authored by Oana-Eliza Alexa's avatar Oana-Eliza Alexa
Browse files

Refactor libraries

1 merge request!76Draft: Resolve "Redesign notifications class"
This commit is part of merge request !76. Comments created here will be created in the context of that merge request.
Showing with 17 additions and 16 deletions
+17 -16
...@@ -64,6 +64,7 @@ class Notifications implements EndpointInterface ...@@ -64,6 +64,7 @@ class Notifications implements EndpointInterface
foreach ($notificationsSubTasks as $task) { foreach ($notificationsSubTasks as $task) {
// If the tasks must be treated - status and scheduled - process the sub-tasks // If the tasks must be treated - status and scheduled - process the sub-tasks
if ($this->gateway->statusAndScheduleCheck($task)) { if ($this->gateway->statusAndScheduleCheck($task)) {
// Retrieve data from the main task // Retrieve data from the main task
$notificationsMainTask = $this->getNotificationsMainTask($task['fdtasksgranularmaster'][0]); $notificationsMainTask = $this->getNotificationsMainTask($task['fdtasksgranularmaster'][0]);
$notificationsMainTaskName = $task['fdtasksgranularmaster'][0]; $notificationsMainTaskName = $task['fdtasksgranularmaster'][0];
...@@ -100,26 +101,26 @@ class Notifications implements EndpointInterface ...@@ -100,26 +101,26 @@ class Notifications implements EndpointInterface
private function getMatchingAttrs (array $notificationsMainTask, array $task): array private function getMatchingAttrs (array $notificationsMainTask, array $task): array
{ {
// Simply retrieve the list of audited attributes // Simply retrieve the list of audited attributes
$auditAttributes = $this->decodeAuditAttributes($task); $auditAttributes = $this->decodeAuditAttributes($task);
// Recovering monitored attributes list from the defined notification task. // Recovering monitored attributes list from the defined notification task.
$monitoredAttrs = $notificationsMainTask[0]['fdtasksnotificationsattributes']; $monitoredAttrs = $notificationsMainTask[0]['fdtasksnotificationsattributes'];
// Reformat supann // Reformat supann
$monitoredSupannResource = $this->getSupannResourceState($notificationsMainTask[0]); $monitoredSupannResource = $this->getSupannResourceState($notificationsMainTask[0]);
// Simply remove keys with 'count' reported by ldap. // Simply remove keys with 'count' reported by ldap.
$this->gateway->unsetCountKeys($monitoredAttrs); $this->gateway->unsetCountKeys($monitoredAttrs);
$this->gateway->unsetCountKeys($monitoredSupannResource); $this->gateway->unsetCountKeys($monitoredSupannResource);
// Find matching attributes between audited and monitored attributes // Find matching attributes between audited and monitored attributes
$matchingAttrs = $this->findMatchingAttributes($auditAttributes, $monitoredAttrs); $matchingAttrs = Utils::findMatchingKeys($auditAttributes, $monitoredAttrs);
// Verify Supann resource state if applicable // Verify Supann resource state if applicable
if ($this->shouldVerifySupannResource($monitoredSupannResource, $auditAttributes)) { if ($this->shouldVerifySupannResource($monitoredSupannResource, $auditAttributes)) {
// Adds it to the mating attrs for further notification process. // Adds it to the mating attrs for further notification process.
$matchingAttrs[] = 'supannRessourceEtat'; $matchingAttrs[] = 'supannRessourceEtat';
} }
return $matchingAttrs; return $matchingAttrs;
} }
......
Supports Markdown
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