From 0c24aadc6414c25876ccbde5300469e05d36b156 Mon Sep 17 00:00:00 2001 From: Dario Nuevo Date: Fri, 22 Mar 2024 17:28:24 +0800 Subject: [PATCH] different logging for restrictions --- src/Graviton/RestBundle/Listener/RestrictionListener.php | 8 +++++--- src/Graviton/SecurityBundle/Service/SecurityUtils.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Graviton/RestBundle/Listener/RestrictionListener.php b/src/Graviton/RestBundle/Listener/RestrictionListener.php index 752d94566..c7266082e 100644 --- a/src/Graviton/RestBundle/Listener/RestrictionListener.php +++ b/src/Graviton/RestBundle/Listener/RestrictionListener.php @@ -160,8 +160,9 @@ public function onPreAggregate(PreAggregateEvent $event) $matchConditions = []; $projectStage = []; + $dataRestrictions = $this->securityUtils->getRequestDataRestrictions(); - foreach ($this->securityUtils->getRequestDataRestrictions() as $fieldName => $fieldValue) { + foreach ($dataRestrictions as $fieldName => $fieldValue) { $projectStage[$fieldName] = 0; if (is_null($fieldValue)) { continue; @@ -201,8 +202,9 @@ public function onPreAggregate(PreAggregateEvent $event) $this->logger->info( 'RESTRICTION onPreAggregate', [ - 'pipeline' => $newPipeline, - 'mode' => $this->securityUtils->getDataRestrictionMode() + 'mode' => $this->securityUtils->getDataRestrictionMode(), + 'values' => $dataRestrictions, + 'pipeline' => $newPipeline ] ); diff --git a/src/Graviton/SecurityBundle/Service/SecurityUtils.php b/src/Graviton/SecurityBundle/Service/SecurityUtils.php index 40e26b3ae..8edc5a17f 100644 --- a/src/Graviton/SecurityBundle/Service/SecurityUtils.php +++ b/src/Graviton/SecurityBundle/Service/SecurityUtils.php @@ -184,7 +184,7 @@ public function getRequestDataRestrictions() if (!is_null($headerValue) && $fieldSpec['type'] == 'int') { $headerValue = (int) $headerValue; } - $restrictions[$fieldSpec['name']] = $headerValue; + $restrictions[$fieldSpec['name']] = (string) $headerValue; } return $restrictions; }