mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Updated registration process
This commit is contained in:
@@ -21,8 +21,8 @@ class AbstractEntity
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
protected function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$this->id = 0;
|
||||
//$this->id = 0;
|
||||
}
|
||||
}
|
||||
|
@@ -4,10 +4,11 @@ namespace App\Entity;
|
||||
|
||||
use App\Entity\Attribut\RightsAttributInterface;
|
||||
use App\Entity\Method\NodeGrantedInterface;
|
||||
use App\Entity\Attribut\NodeAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface LawInterface extends RightsAttributInterface, NodeGrantedInterface
|
||||
interface LawInterface extends RightsAttributInterface, NodeGrantedInterface, NodeAttributInterface
|
||||
{
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ use App\Entity\Attribut\SourceAttribut;
|
||||
use App\Entity\Attribut\ParentsAttribut;
|
||||
use App\Entity\Attribut\ChildsAttribut;
|
||||
use App\Entity\Attribut\LawAttribut;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -41,20 +42,8 @@ class Node extends AbstractEntity implements NodeInterface
|
||||
public function __construct()
|
||||
{
|
||||
$this->law = new Law();
|
||||
$this->parents = new ArrayCollection();
|
||||
$this->childs = new ArrayCollection();
|
||||
$this->law->setNode($this);
|
||||
$this->initPermissions();
|
||||
}
|
||||
|
||||
private function initPermissions(): void
|
||||
{
|
||||
/*
|
||||
* @var RightInterface
|
||||
*/
|
||||
foreach ($this->law->getRights()->toArray() as $right) {
|
||||
$permission = new Permission();
|
||||
$permission->setNode($this);
|
||||
$permission->setRight($right);
|
||||
$right->addPermission($permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,9 +8,7 @@ use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
|
||||
use App\Entity\Attribut\LawAttribut;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\Entity\Attribut\PermissionsAttribut;
|
||||
use App\Entity\Attribut\NodeAttribut;
|
||||
use App\Entity\Attribut\RecieverAttribut;
|
||||
use App\Entity\Attribut\GrantAttribut;
|
||||
use App\Logic\Operation\OperationInterface;
|
||||
use App\Entity\Attribut\ConditionAttribut;
|
||||
@@ -24,7 +22,7 @@ use App\Entity\Attribut\LayerAttribut;
|
||||
*/
|
||||
class Right extends AbstractEntity implements RightInterface
|
||||
{
|
||||
use TypeAttribut,LawAttribut,PermissionsAttribut, NodeAttribut, RecieverAttribut,GrantAttribut,ConditionAttribut,RecieverGroupAttribut,LayerAttribut;
|
||||
use TypeAttribut,LawAttribut, NodeAttribut, GrantAttribut,ConditionAttribut,RecieverGroupAttribut,LayerAttribut;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Law", inversedBy="rights")
|
||||
@@ -75,7 +73,8 @@ class Right extends AbstractEntity implements RightInterface
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="AbstractOperation",cascade={"persist"})
|
||||
* @ORM\Column(nullable=true)
|
||||
* @ORM\JoinColumn(name="operation_id", referencedColumnName="id",nullable=true)
|
||||
*
|
||||
* @var OperationInterface
|
||||
*/
|
||||
protected $condition;
|
||||
@@ -84,7 +83,8 @@ class Right extends AbstractEntity implements RightInterface
|
||||
{
|
||||
parent::__construct();
|
||||
$this->grant = true;
|
||||
$this->recieverGroup = new RecieverGroup();
|
||||
//$this->node = new Node();
|
||||
//$this->recieverGroup = new RecieverGroup();
|
||||
}
|
||||
|
||||
public function isGranted(NodeInterface $node, string $layer, string $right): bool
|
||||
|
@@ -43,5 +43,6 @@ class User extends BaseUser implements SourceAttributInterface
|
||||
$this->isActive = true;
|
||||
$this->source = new UserSource();
|
||||
LawModificator::grantAllRights($this->source->getNode()->getLaw(), $this->source->getNode());
|
||||
//var_dump($this->source->getNode()->getLaw()->getRights()->get(0));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user