From 0c090b2161012919ea40ff3007160b285bcd1ca7 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Wed, 15 Nov 2023 23:27:18 -0500 Subject: [PATCH] - Fixed a bug where unlocked security were still triggering Taxus() checkup --- src/SecurityHandler.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SecurityHandler.php b/src/SecurityHandler.php index f717795..81d2b02 100644 --- a/src/SecurityHandler.php +++ b/src/SecurityHandler.php @@ -24,12 +24,16 @@ class SecurityHandler { public function verify(string $className, string $methodName) : ? ResponseInterface { - # Should generate an equivalent of Ulmus's object reflection here ! + return $this->isLocked($className, $methodName) ? $this->redirectResponse : null; + } + + public function isLocked(string $className, string $methodName) : bool + { if ( $security = $this->getClassAttributes(Attribute\Security::class, $className, $methodName) ) { - return array_pop($security)->locked ? $this->redirectResponse : null; + return array_pop($security)->locked; } - return null; + return true; } public function taxus(string $className, string $methodName, object $user = null) : ? ResponseInterface @@ -52,7 +56,7 @@ class SecurityHandler { return null; } - protected function getClassAttributes(string $annotationClass, string $className, string $methodName)/* : \Notes\Annotation|array */ + protected function getClassAttributes(string $annotationClass, string $className, string $methodName)/* : \Notes\Attribute|array */ { $objectResolver = new ObjectResolver($className, true, true, false, true);