Skip to content

Commit

Permalink
Adding unaudited fields configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir Compres authored and Samir Compres committed Dec 30, 2019
1 parent 680791c commit f6eb430
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/DataDog/AuditBundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ public function getConfigTreeBuilder()
->end()
;

$rootNode->children()
->arrayNode('unaudited_fields')
->arrayPrototype()
->arrayPrototype()
->prototype('scalar')->end()
->end()
->end()
->end()
;

$rootNode
->children()
->arrayNode('unaudited_request_fields')
->canBeUnset()
->performNoDeepMerging()
->prototype('scalar')->end()
->end()
->end()
;

return $treeBuilder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ public function load(array $configs, ContainerBuilder $container)
$this->defaultConfiguration['audit_request']['enabled'] = $config['audit_request']['enabled'];
}

if (isset($config['unaudited_fields']) && !empty($config['unaudited_fields'])) {
$auditSubscriber->addMethodCall('addUnauditedFields', array($config['unaudited_fields']));
}

if (isset($config['unaudited_request_fields']) && !empty($config['unaudited_request_fields'])) {
$this->defaultConfiguration['unaudited_request_fields'] = $config['unaudited_request_fields'];
$container->setParameter('nti_audit.audit_request.unaudited_request_fields', $this->defaultConfiguration['unaudited_request_fields']);
} else {
$container->setParameter('nti_audit.audit_request.unaudited_request_fields', array());
}

$container->setParameter('nti_audit.audit_request.enabled', $this->defaultConfiguration['audit_request']['enabled']);
}
}

0 comments on commit f6eb430

Please sign in to comment.