Substituted whitelist and blacklist attribute trough grant attribute

This commit is contained in:
Kevin Frantz 2018-09-14 13:33:56 +02:00
parent 043c8d45b7
commit f66cb4a8ce
4 changed files with 43 additions and 16 deletions

View File

@ -0,0 +1,24 @@
<?php
namespace App\Entity\Attribut;
/**
* @author kevinfrantz
*/
trait GrantAttribut
{
/**
* @var bool
*/
protected $grant;
public function setGrant(bool $grant): void
{
$this->grant = $grant;
}
public function getGrant(): bool
{
return $this->grant;
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Entity\Attribut;
/**
* @author kevinfrantz
*/
interface GrantAttributInterface
{
public function setGrant(bool $grant): void;
public function getGrant(): bool;
}

View File

@ -3,13 +3,12 @@
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Attribut\BlacklistAttribut;
use App\Entity\Attribut\WhitelistAttribut;
use App\Entity\Attribut\NodeAttribut;
use App\Entity\Attribut\RightAttribut;
use App\Entity\Attribut\RecieverAttribut;
use App\DBAL\Types\RecieverType;
use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
use App\Entity\Attribut\GrantAttribut;
/**
* @author kevinfrantz
@ -18,7 +17,7 @@ use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
*/
class Permission extends AbstractEntity implements PermissionInterface
{
use NodeAttribut,RightAttribut,WhitelistAttribut,BlacklistAttribut,RecieverAttribut;
use NodeAttribut,RightAttribut,RecieverAttribut,GrantAttribut;
/**
* @ORM\Column(name="reciever", type="RecieverType", nullable=false)
@ -33,14 +32,7 @@ class Permission extends AbstractEntity implements PermissionInterface
*
* @var bool
*/
protected $blacklist;
/**
* @ORM\Column(type="boolean")
*
* @var bool
*/
protected $whitelist;
protected $grant;
/**
* @ORM\ManyToOne(targetEntity="Node")
@ -60,7 +52,6 @@ class Permission extends AbstractEntity implements PermissionInterface
public function __construct()
{
$this->blacklist = false;
$this->whitelist = false;
$this->grant = true;
}
}

View File

@ -2,15 +2,14 @@
namespace App\Entity;
use App\Entity\Attribut\BlacklistAttributInterface;
use App\Entity\Attribut\WhitelistAttributInterface;
use App\Entity\Attribut\NodeAttributInterface;
use App\Entity\Attribut\RightAttributInterface;
use App\Entity\Attribut\RecieverAttributInterface;
use App\Entity\Attribut\GrantAttributInterface;
/**
* @author kevinfrantz
*/
interface PermissionInterface extends BlacklistAttributInterface, WhitelistAttributInterface, NodeAttributInterface, RightAttributInterface, RecieverAttributInterface
interface PermissionInterface extends NodeAttributInterface, RightAttributInterface, RecieverAttributInterface, GrantAttributInterface
{
}