diff --git a/application/config/packages/doctrine.yaml b/application/config/packages/doctrine.yaml index cc74c69..f7fbb4e 100644 --- a/application/config/packages/doctrine.yaml +++ b/application/config/packages/doctrine.yaml @@ -14,8 +14,9 @@ doctrine: default_table_options: charset: utf8mb4 collate: utf8mb4_unicode_ci - url: '%env(resolve:DATABASE_URL)%' + types: + RightType: App\DBAL\Types\RightType orm: auto_generate_proxy_classes: '%kernel.debug%' naming_strategy: doctrine.orm.naming_strategy.underscore diff --git a/application/src/DBAL/Types/RightType.php b/application/src/DBAL/Types/RightType.php new file mode 100644 index 0000000..9a24ef4 --- /dev/null +++ b/application/src/DBAL/Types/RightType.php @@ -0,0 +1,25 @@ + 'administration', + self::READ => 'read', + self::WRITE=>'write', + ]; +} + diff --git a/application/src/Entity/Attribut/RightAttributInterface.php b/application/src/Entity/Attribut/RightAttributInterface.php index 96636d7..3c65319 100644 --- a/application/src/Entity/Attribut/RightAttributInterface.php +++ b/application/src/Entity/Attribut/RightAttributInterface.php @@ -1,6 +1,8 @@ rights = $rights; + } + + public function getRights():ArrayCollection{ + return $this->rights; + } +} + diff --git a/application/src/Entity/Attribut/TypeAttribut.php b/application/src/Entity/Attribut/TypeAttribut.php new file mode 100644 index 0000000..a4cc116 --- /dev/null +++ b/application/src/Entity/Attribut/TypeAttribut.php @@ -0,0 +1,24 @@ +type = $type; + } + + public function getType():string{ + return $this->type; + } +} + diff --git a/application/src/Entity/Attribut/TypeAttributInterface.php b/application/src/Entity/Attribut/TypeAttributInterface.php new file mode 100644 index 0000000..afbf8cd --- /dev/null +++ b/application/src/Entity/Attribut/TypeAttributInterface.php @@ -0,0 +1,15 @@ +initAllRights(); + } + + private function initAllRights(): void + { + foreach (RightType::getChoices() as $key=>$value){ + $right = new Right(); + $right->setType($value); + $this->rights->set($key, $right); + } + } + } diff --git a/application/src/Entity/LawInterface.php b/application/src/Entity/LawInterface.php index 6bec9f7..aa9cd0b 100644 --- a/application/src/Entity/LawInterface.php +++ b/application/src/Entity/LawInterface.php @@ -1,14 +1,15 @@ law = new Law(); + $this->law->setNode($this); } } diff --git a/application/src/Entity/PermissionInterface.php b/application/src/Entity/PermissionInterface.php index c25c029..9ce197d 100644 --- a/application/src/Entity/PermissionInterface.php +++ b/application/src/Entity/PermissionInterface.php @@ -11,5 +11,6 @@ use Entity\Attribut\WhitelistAttributInterface; */ interface PermissionInterface extends BlacklistAttributInterface, WhitelistAttributInterface { + } diff --git a/application/src/Entity/Right.php b/application/src/Entity/Right.php new file mode 100644 index 0000000..24de0d9 --- /dev/null +++ b/application/src/Entity/Right.php @@ -0,0 +1,34 @@ +