mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 17:29:04 +00:00 
			
		
		
		
	In between commit refactoring and implementing tests
This commit is contained in:
		| @@ -1,24 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| trait BlacklistAttribut | ||||
| { | ||||
|     /** | ||||
|      * @var bool | ||||
|      */ | ||||
|     protected $blacklist; | ||||
|  | ||||
|     public function setBlacklist(?bool $value): void | ||||
|     { | ||||
|         $this->blacklist = $value; | ||||
|     } | ||||
|  | ||||
|     public function getBlacklist(): ?bool | ||||
|     { | ||||
|         return $this->blacklist; | ||||
|     } | ||||
| } | ||||
| @@ -1,13 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface BlacklistAttributInterface | ||||
| { | ||||
|     public function setBlacklist(?bool $value): void; | ||||
|  | ||||
|     public function getBlacklist(): ?bool; | ||||
| } | ||||
| @@ -2,7 +2,6 @@ | ||||
|  | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| use App\Entity\NodeInterface; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
|  | ||||
| /** | ||||
| @@ -11,7 +10,7 @@ use Doctrine\Common\Collections\Collection; | ||||
| trait ChildsAttribut | ||||
| { | ||||
|     /** | ||||
|      * @var Collection|NodeInterface[] | ||||
|      * @var Collection|ChildsAttributeInterface[] | ||||
|      */ | ||||
|     protected $childs; | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|  | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| use App\Entity\NodeInterface; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
|  | ||||
| /** | ||||
| @@ -11,7 +10,7 @@ use Doctrine\Common\Collections\Collection; | ||||
| trait ParentsAttribut | ||||
| { | ||||
|     /** | ||||
|      * @var Collection|NodeInterface[] | ||||
|      * @var Collection|ParentsAttributInterface[] | ||||
|      */ | ||||
|     protected $parents; | ||||
|  | ||||
|   | ||||
| @@ -1,29 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| use Symfony\Component\Validator\Constraints as Assert; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| trait PlainPasswordAttribute | ||||
| { | ||||
|     /** | ||||
|      * @Assert\NotBlank() | ||||
|      * @Assert\Length(max=4096) | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     private $plainPassword; | ||||
|  | ||||
|     public function getPlainPassword(): ?string | ||||
|     { | ||||
|         return $this->plainPassword; | ||||
|     } | ||||
|  | ||||
|     public function setPlainPassword(string $password): void | ||||
|     { | ||||
|         $this->plainPassword = $password; | ||||
|     } | ||||
| } | ||||
| @@ -1,24 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| trait WhitelistAttribut | ||||
| { | ||||
|     /** | ||||
|      * @var bool | ||||
|      */ | ||||
|     protected $whitelist; | ||||
|  | ||||
|     public function setWhitelist(?bool $value): void | ||||
|     { | ||||
|         $this->whitelist = $value; | ||||
|     } | ||||
|  | ||||
|     public function getWhitelist(): ?bool | ||||
|     { | ||||
|         return $this->whitelist; | ||||
|     } | ||||
| } | ||||
| @@ -1,13 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface WhitelistAttributInterface | ||||
| { | ||||
|     public function setWhitelist(?bool $value): void; | ||||
|  | ||||
|     public function getWhitelist(): ?bool; | ||||
| } | ||||
| @@ -12,7 +12,7 @@ use App\Entity\Attribut\RelationAttribut; | ||||
|  * @ORM\Table(name="meta_law") | ||||
|  * @ORM\Entity(repositoryClass="App\Repository\LawRepository") | ||||
|  */ | ||||
| class Law extends AbstractMeta implements LawInterface | ||||
| final class Law extends AbstractMeta implements LawInterface | ||||
| { | ||||
|     use RightsAttribute, RelationAttribut; | ||||
|  | ||||
| @@ -24,15 +24,6 @@ class Law extends AbstractMeta implements LawInterface | ||||
|      */ | ||||
|     protected $rights; | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @ORM\OneToOne(targetEntity="Relation",cascade={"persist", "remove"}) | ||||
|      * @ORM\JoinColumn(name="relation_id", referencedColumnName="id") | ||||
|      * | ||||
|      * @var RelationInterface | ||||
|      */ | ||||
|     protected $relation; | ||||
|  | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->initAllRights(); | ||||
|   | ||||
| @@ -9,6 +9,6 @@ use App\Entity\Method\RelationGrantedInterface; | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface LawInterface extends RightsAttributInterface, RelationGrantedInterface, RelationAttributInterface,MetaInterface | ||||
| interface LawInterface extends RightsAttributInterface, RelationGrantedInterface, MetaInterface | ||||
| { | ||||
| } | ||||
|   | ||||
| @@ -16,7 +16,7 @@ use App\Entity\Attribut\RelationAttributInterface; | ||||
|  * @ORM\Table(name="meta_reciever_group") | ||||
|  * @ORM\Entity() | ||||
|  */ | ||||
| class RecieverGroup extends AbstractMeta implements RecieverGroupInterface | ||||
| final class RecieverGroup extends AbstractMeta implements RecieverGroupInterface | ||||
| { | ||||
|     use RelationAttribut,RecieverAttribut; | ||||
|  | ||||
|   | ||||
| @@ -21,7 +21,7 @@ use Doctrine\Common\Collections\Collection; | ||||
|  * @ORM\Table(name="meta_relation") | ||||
|  * @ORM\Entity() | ||||
|  */ | ||||
| class Relation extends AbstractMeta implements RelationInterface | ||||
| final class Relation extends AbstractMeta implements RelationInterface | ||||
| { | ||||
|     use IdAttribut, | ||||
|     SourceAttribut, | ||||
| @@ -76,6 +76,6 @@ class Relation extends AbstractMeta implements RelationInterface | ||||
|         $this->law = new Law(); | ||||
|         $this->parents = new ArrayCollection(); | ||||
|         $this->childs = new ArrayCollection(); | ||||
|         $this->law->setNode($this); | ||||
|         //$this->law->setNode($this); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -20,7 +20,7 @@ use App\Entity\Attribut\RelationAttribut; | ||||
|  * @ORM\Table(name="meta_right") | ||||
|  * @ORM\Entity(repositoryClass="App\Repository\RightRepository") | ||||
|  */ | ||||
| class Right extends AbstractMeta implements RightInterface | ||||
| final class Right extends AbstractMeta implements RightInterface | ||||
| { | ||||
|     use TypeAttribut,LawAttribut, RelationAttribut, GrantAttribut,ConditionAttribut,RecieverGroupAttribut,LayerAttribut; | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Source; | ||||
|  | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| @@ -10,10 +9,15 @@ use App\Entity\Source\Attribut\GroupSourcesAttribut; | ||||
| use App\Entity\Meta\RelationInterface; | ||||
| use App\Entity\Attribut\RelationAttribut; | ||||
| use App\Entity\Meta\Relation; | ||||
| use App\Entity\Attribut\LawAttribut; | ||||
| use App\Entity\Meta\LawInterface; | ||||
| use App\Entity\Meta\Law; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  * @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html | ||||
|  * @ORM\Entity | ||||
|  * @ORM\Table(name="source") | ||||
| @@ -23,9 +27,10 @@ use App\Entity\Meta\Relation; | ||||
|  */ | ||||
| abstract class AbstractSource extends AbstractEntity implements SourceInterface | ||||
| { | ||||
|     use RelationAttribut,GroupSourcesAttribut; | ||||
|     use RelationAttribut,GroupSourcesAttribut, LawAttribut; | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @var RelationInterface | ||||
|      * @ORM\OneToOne(targetEntity="App\Entity\Meta\Relation",cascade={"persist", "remove"}) | ||||
|      * @ORM\JoinColumn(name="relation_id", referencedColumnName="id") | ||||
| @@ -34,17 +39,29 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface | ||||
|     protected $relation; | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @todo Implement that just one table on database level is needed! | ||||
|      * @todo Rename table to use the right schema | ||||
|      * @var Collection|GroupSource[] | ||||
|      * @ORM\ManyToMany(targetEntity="GroupSource") | ||||
|      */ | ||||
|     protected $groups; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @ORM\OneToOne(targetEntity="Law",cascade={"persist", "remove"}) | ||||
|      * @ORM\JoinColumn(name="law_id", referencedColumnName="id") | ||||
|      * | ||||
|      * @var LawInterface | ||||
|      */ | ||||
|     protected $law; | ||||
|  | ||||
|     public function __construct() | ||||
|     { | ||||
|         parent::__construct(); | ||||
|         $this->relation = new Relation(); | ||||
|         $this->relation->setSource($this); | ||||
|         $this->law = new Law(); | ||||
|         $this->groups = new ArrayCollection(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -12,7 +12,7 @@ use App\Entity\Source\Attribut\MembersAttribut; | ||||
|  * @ORM\Table(name="source_group") | ||||
|  * @ORM\Entity | ||||
|  */ | ||||
| class GroupSource extends AbstractSource implements MembersAttributInterface | ||||
| final class GroupSource extends AbstractSource implements MembersAttributInterface | ||||
| { | ||||
|     use MembersAttribut; | ||||
|  | ||||
|   | ||||
| @@ -12,7 +12,7 @@ use App\Entity\Source\NameSourceInterface; | ||||
|  * @ORM\Table(name="source_name") | ||||
|  * @ORM\Entity(repositoryClass="App\Repository\NameSourceRepository") | ||||
|  */ | ||||
| class NameSource extends AbstractSource implements NameSourceInterface | ||||
| final class NameSource extends AbstractSource implements NameSourceInterface | ||||
| { | ||||
|     use NameAttribut; | ||||
|  | ||||
|   | ||||
| @@ -4,11 +4,12 @@ namespace App\Entity\Source; | ||||
| use App\Entity\Attribut\IdAttributInterface; | ||||
| use App\Entity\EntityInterface; | ||||
| use App\Entity\Source\Attribut\GroupSourcesAttributInterface; | ||||
| use App\Entity\Attribut\LawAttributInterface; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface SourceInterface extends IdAttributInterface, EntityInterface, GroupSourcesAttributInterface | ||||
| interface SourceInterface extends IdAttributInterface, EntityInterface, GroupSourcesAttributInterface, LawAttributInterface | ||||
| { | ||||
| } | ||||
|   | ||||
| @@ -13,7 +13,7 @@ use App\Entity\UserInterface; | ||||
|  * @ORM\Table(name="source_user") | ||||
|  * @ORM\Entity(repositoryClass="App\Repository\UserSourceRepository") | ||||
|  */ | ||||
| class UserSource extends AbstractSource implements UserSourceInterface | ||||
| final class UserSource extends AbstractSource implements UserSourceInterface | ||||
| { | ||||
|     use UserAttribut,NameSourceAttribut; | ||||
|  | ||||
|   | ||||
| @@ -46,12 +46,14 @@ class User extends BaseUser implements UserInterface | ||||
|      */ | ||||
|     protected $version; | ||||
|  | ||||
|     /** | ||||
|      * @todo Initialize all needed attributs | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         parent::__construct(); | ||||
|         $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)); | ||||
|         //LawModificator::grantAllRights($this->source->getNode()->getLaw(), $this->source->getNode()); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| <?php | ||||
| namespace App\Structur\Facade\Security\Source; | ||||
|  | ||||
| use App\Entity\Meta\LawInterface; | ||||
| use App\Entity\Source\NameSourceInterface; | ||||
| use App\Entity\Source\SourceInterface; | ||||
| use App\Entity\UserInterface; | ||||
| @@ -10,7 +11,7 @@ use App\DBAL\Types\LayerType; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @todo check if this layer makes sense | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterface | ||||
| @@ -96,4 +97,20 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa | ||||
|      * @todo Implement | ||||
|      */ | ||||
|     } | ||||
|     public function setLaw(LawInterface $law): void | ||||
|     { | ||||
|         /** | ||||
|          * | ||||
|          * @todo Implement | ||||
|          */ | ||||
|     } | ||||
|  | ||||
|     public function getLaw(): LawInterface | ||||
|     { | ||||
|         /** | ||||
|          * | ||||
|          * @todo Implement | ||||
|          */ | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user