mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Refactored interface
This commit is contained in:
parent
0c2a832136
commit
8f983659bc
@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Attribut\RightsAttribute;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attribut\RelationAttribut;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -33,7 +34,7 @@ final class Law extends AbstractMeta implements LawInterface
|
||||
$this->rights = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
|
||||
public function isGranted(SourceInterface $source, string $layer, string $right): bool
|
||||
{
|
||||
/*
|
||||
*
|
||||
|
@ -3,11 +3,11 @@
|
||||
namespace App\Entity\Meta;
|
||||
|
||||
use App\Entity\Attribut\RightsAttributInterface;
|
||||
use App\Entity\Method\RelationGrantedInterface;
|
||||
use App\Entity\Method\GrantedInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface LawInterface extends RightsAttributInterface, RelationGrantedInterface, MetaInterface
|
||||
interface LawInterface extends RightsAttributInterface,GrantedInterface, MetaInterface
|
||||
{
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ use App\Entity\Attribut\ConditionAttribut;
|
||||
use App\Entity\Attribut\RecieverAttribut;
|
||||
use App\Entity\Attribut\LayerAttribut;
|
||||
use App\Entity\Attribut\RelationAttribut;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -85,7 +86,7 @@ final class Right extends AbstractMeta implements RightInterface
|
||||
$this->grant = true;
|
||||
}
|
||||
|
||||
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
|
||||
public function isGranted(SourceInterface $source, string $layer, string $right): bool
|
||||
{
|
||||
if ($this->layer == $layer && $this->type == $right && $this->checkIfNodeIsReciever($relation) && $this->getConditionBoolOrTrue()) {
|
||||
return $this->grant;
|
||||
|
@ -8,12 +8,12 @@ use App\Entity\Attribut\RecieverAttributInterface;
|
||||
use App\Entity\Attribut\GrantAttributInterface;
|
||||
use App\Entity\Attribut\ConditionAttributInterface;
|
||||
use App\Entity\Attribut\LayerAttributInterface;
|
||||
use App\Entity\Method\RelationGrantedInterface;
|
||||
use App\Entity\Method\GrantedInterface;
|
||||
use App\Entity\Attribut\RelationAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RightInterface extends TypeAttributInterface, LawAttributInterface, RelationGrantedInterface, GrantAttributInterface, RecieverAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface
|
||||
interface RightInterface extends TypeAttributInterface, LawAttributInterface, GrantedInterface, GrantAttributInterface, RecieverAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface
|
||||
{
|
||||
}
|
||||
|
19
application/src/Entity/Method/GrantedInterface.php
Normal file
19
application/src/Entity/Method/GrantedInterface.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Method;
|
||||
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface GrantedInterface
|
||||
{
|
||||
/**
|
||||
* Returns true if the source is granted access to the layer with the requested right.
|
||||
* @param SourceInterface $source
|
||||
* @param string $right
|
||||
* @return bool
|
||||
*/
|
||||
public function isGranted(SourceInterface $source, string $layer, string $right): bool;
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Method;
|
||||
|
||||
use App\Entity\Meta\RelationInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RelationGrantedInterface
|
||||
{
|
||||
/**
|
||||
* @deprecated Methods shouldn't be used on the entity level
|
||||
*
|
||||
* @param RelationInterface $relation
|
||||
* @param string $layer
|
||||
* @param string $right
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isGranted(RelationInterface $relation, string $layer, string $right): bool;
|
||||
}
|
Loading…
Reference in New Issue
Block a user