- Removing annotations replaced by attributes
This commit is contained in:
parent
66a9345e06
commit
1337e778ed
|
@ -6,7 +6,7 @@
|
|||
"authors": [
|
||||
{
|
||||
"name": "Dave Mc Nicoll",
|
||||
"email": "mcndave@gmail.com"
|
||||
"email": "info@mcnd.ca"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
|
|
|
@ -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) { }
|
||||
|
||||
|
|
Loading…
Reference in New Issue