- Fixed a bug where unlocked security were still triggering Taxus() checkup

This commit is contained in:
Dave M. 2023-11-15 23:27:18 -05:00
parent fcbffa3c55
commit 0c090b2161
1 changed files with 8 additions and 4 deletions

View File

@ -24,12 +24,16 @@ class SecurityHandler {
public function verify(string $className, string $methodName) : ? ResponseInterface 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) ) { 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 public function taxus(string $className, string $methodName, object $user = null) : ? ResponseInterface
@ -52,7 +56,7 @@ class SecurityHandler {
return null; 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); $objectResolver = new ObjectResolver($className, true, true, false, true);