Skip to content

Commit

Permalink
Merge pull request #7 from ntidev/adding-unaudited-fields-feature
Browse files Browse the repository at this point in the history
Adding unaudited fields configuration
  • Loading branch information
bvisonl authored Dec 30, 2019
2 parents df0103d + f6eb430 commit c528859
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 c528859

Please sign in to comment.