- Fixed a bug where unlocked security were still triggering Taxus() checkup
This commit is contained in:
parent
fcbffa3c55
commit
0c090b2161
|
@ -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;
|
||||||
if ( $security = $this->getClassAttributes(Attribute\Security::class, $className, $methodName) ) {
|
|
||||||
return array_pop($security)->locked ? $this->redirectResponse : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
public function isLocked(string $className, string $methodName) : bool
|
||||||
|
{
|
||||||
|
if ( $security = $this->getClassAttributes(Attribute\Security::class, $className, $methodName) ) {
|
||||||
|
return array_pop($security)->locked;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue