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);