diff --git a/src/DataDog/AuditBundle/DependencyInjection/Configuration.php b/src/DataDog/AuditBundle/DependencyInjection/Configuration.php index 419eb4d..cfa4502 100755 --- a/src/DataDog/AuditBundle/DependencyInjection/Configuration.php +++ b/src/DataDog/AuditBundle/DependencyInjection/Configuration.php @@ -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; } diff --git a/src/DataDog/AuditBundle/DependencyInjection/DataDogAuditExtension.php b/src/DataDog/AuditBundle/DependencyInjection/DataDogAuditExtension.php index 6d685d1..be89a38 100755 --- a/src/DataDog/AuditBundle/DependencyInjection/DataDogAuditExtension.php +++ b/src/DataDog/AuditBundle/DependencyInjection/DataDogAuditExtension.php @@ -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']); } }