From 1337e778ed46b0549e1639a240ee0b2e5dfe78b6 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll <info@mcnd.ca> Date: Fri, 3 Nov 2023 19:53:50 -0400 Subject: [PATCH] - Removing annotations replaced by attributes --- composer.json | 2 +- src/SecurityHandler.php | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index b6ff421..e1ea617 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "authors": [ { "name": "Dave Mc Nicoll", - "email": "mcndave@gmail.com" + "email": "info@mcnd.ca" } ], "require": { diff --git a/src/SecurityHandler.php b/src/SecurityHandler.php index 5b73792..f717795 100644 --- a/src/SecurityHandler.php +++ b/src/SecurityHandler.php @@ -6,8 +6,7 @@ use Taxus\Taxus; use Psr\Http\Message\ResponseInterface; -use Notes\ObjectReflection, - Notes\ObjectResolver; +use Notes\ObjectResolver; class SecurityHandler { @@ -26,7 +25,7 @@ class SecurityHandler { public function verify(string $className, string $methodName) : ? ResponseInterface { # Should generate an equivalent of Ulmus's object reflection here ! - if ( $security = $this->getClassAnnotations(Annotation\Security::class, $className, $methodName) ) { + if ( $security = $this->getClassAttributes(Attribute\Security::class, $className, $methodName) ) { return array_pop($security)->locked ? $this->redirectResponse : null; } @@ -35,7 +34,7 @@ class SecurityHandler { public function taxus(string $className, string $methodName, object $user = null) : ? ResponseInterface { - if ($taxus = $this->getClassAnnotations(Annotation\Taxus::class, $className, $methodName)) { + if ($taxus = $this->getClassAttributes(Attribute\Taxus::class, $className, $methodName)) { if ($this->unauthorizeResponse) { foreach ($taxus as $item) { if (!isset($item->privilege) || $this->taxus->granted($item->privilege, $user, $item)) { @@ -53,12 +52,12 @@ class SecurityHandler { return null; } - protected function getClassAnnotations(string $annotationClass, string $className, string $methodName)/* : \Notes\Annotation|array */ + protected function getClassAttributes(string $annotationClass, string $className, string $methodName)/* : \Notes\Annotation|array */ { $objectResolver = new ObjectResolver($className, true, true, false, true); try { - $method = $objectResolver->getAnnotationListFromClassname( $annotationClass, false ); + $method = $objectResolver->getAttributeListFromClassname( $annotationClass, false ); } catch(\Exception $e) { }