mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Updated type references
This commit is contained in:
parent
d1676fea7c
commit
7300f059c3
@ -16,8 +16,8 @@ doctrine:
|
||||
collate: utf8mb4_unicode_ci
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
types:
|
||||
RightType: App\DBAL\Types\RightType
|
||||
LayerType: App\DBAL\Types\LayerType
|
||||
CRUDType: App\DBAL\Types\Meta\Right\CRUDType
|
||||
LayerType: App\DBAL\Types\Meta\Right\LayerType
|
||||
orm:
|
||||
auto_generate_proxy_classes: '%kernel.debug%'
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||
|
@ -7,8 +7,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use App\DBAL\Types\SystemSlugType;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use App\Entity\Source\PureSource;
|
||||
use App\Domain\ResponseManagement\SourceRESTResponseManager;
|
||||
@ -31,7 +31,7 @@ final class DefaultController extends AbstractEntityController
|
||||
$requestedRight = new Right();
|
||||
$requestedRight->setSource($requestedSource);
|
||||
$requestedRight->setLayer(LayerType::SOURCE);
|
||||
$requestedRight->setType(RightType::READ);
|
||||
$requestedRight->setType(CRUDType::READ);
|
||||
$sourceResponseManager = new SourceRESTResponseManager($this->getUser(), $entityManager, $requestedRight, $this->getViewHandler());
|
||||
|
||||
return $sourceResponseManager->getResponse();
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\DBAL\Types\Meta;
|
||||
namespace App\DBAL\Types\Meta\Right;
|
||||
|
||||
use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
|
||||
|
||||
|
@ -10,8 +10,8 @@ use App\DBAL\Types\SystemSlugType;
|
||||
use App\Entity\Source\Complex\UserSource;
|
||||
use App\Entity\Source\Complex\UserSourceInterface;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Domain\SourceManagement\SourceRightManager;
|
||||
|
||||
@ -65,7 +65,7 @@ class SourceFixtures extends Fixture
|
||||
$sourceRightManager = new SourceRightManager($this->impressumSource);
|
||||
$sourceRightManager->addRight($right);
|
||||
$right->setLayer(LayerType::SOURCE);
|
||||
$right->setType(RightType::READ);
|
||||
$right->setType(CRUDType::READ);
|
||||
$right->setReciever($this->guestUserSource);
|
||||
|
||||
return $right;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Domain\TemplateManagement;
|
||||
|
||||
use App\DBAL\Types\TemplateType;
|
||||
use App\DBAL\Types\RESTResponseType;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -22,7 +22,7 @@ final class TemplateMeta implements TemplateMetaInterface
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type = TemplateType::HTML;
|
||||
private $type = RESTResponseType::HTML;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -6,8 +6,7 @@ use App\Entity\Attribut\TypeAttribut;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
|
||||
use App\Entity\Attribut\LawAttribut;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\Entity\Attribut\GrantAttribut;
|
||||
use App\Logic\Operation\OperationInterface;
|
||||
use App\Entity\Attribut\ConditionAttribut;
|
||||
@ -17,6 +16,7 @@ use App\Entity\Attribut\RelationAttribut;
|
||||
use App\Entity\Attribut\PriorityAttribut;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
use App\Exception\NoValidChoiceException;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -52,7 +52,7 @@ class Right extends AbstractMeta implements RightInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="layer", type="LayerType", nullable=false)
|
||||
* @DoctrineAssert\Enum(entity="App\DBAL\Types\LayerType")
|
||||
* @DoctrineAssert\Enum(entity="App\DBAL\Types\Meta\Right\LayerType")
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
@ -75,8 +75,8 @@ class Right extends AbstractMeta implements RightInterface
|
||||
protected $grant;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="type", type="RightType", nullable=false)
|
||||
* @DoctrineAssert\Enum(entity="App\DBAL\Types\RightType")
|
||||
* @ORM\Column(name="type", type="CRUDType", nullable=false)
|
||||
* @DoctrineAssert\Enum(entity="App\DBAL\Types\Meta\Right\CRUDType")
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
@ -99,7 +99,7 @@ class Right extends AbstractMeta implements RightInterface
|
||||
|
||||
public function setType(string $type): void
|
||||
{
|
||||
if (!array_key_exists($type, RightType::getChoices())) {
|
||||
if (!array_key_exists($type, CRUDType::getChoices())) {
|
||||
throw new NoValidChoiceException();
|
||||
}
|
||||
$this->type = $type;
|
||||
|
@ -5,7 +5,7 @@ namespace Tests\Integration\Controller\API;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\BrowserKit\Request;
|
||||
use App\DBAL\Types\LanguageType;
|
||||
use App\DBAL\Types\Meta\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\RESTResponseType;
|
||||
|
||||
/**
|
||||
|
@ -7,8 +7,8 @@ use App\Domain\LawManagement\LawPermissionCheckerService;
|
||||
use App\Domain\LawManagement\LawPermissionCheckerServiceInterface;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Entity\Meta\Law;
|
||||
use App\Entity\Meta\LawInterface;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
@ -87,7 +87,7 @@ class LawPermissionCheckerTest extends TestCase
|
||||
{
|
||||
$this->clientRight = new Right();
|
||||
$this->clientRight->setLayer(LayerType::SOURCE);
|
||||
$this->clientRight->setType(RightType::READ);
|
||||
$this->clientRight->setType(CRUDType::READ);
|
||||
$this->clientRight->setReciever($this->clientSource);
|
||||
$this->clientRight->setSource($this->source);
|
||||
}
|
||||
@ -107,7 +107,7 @@ class LawPermissionCheckerTest extends TestCase
|
||||
{
|
||||
$this->law->getRights()->add($this->getClonedClientRight());
|
||||
$this->assertTrue($this->checkClientPermission());
|
||||
$this->clientRight->setType(RightType::WRITE);
|
||||
$this->clientRight->setType(CRUDType::UPDATE);
|
||||
$this->assertFalse($this->checkClientPermission());
|
||||
}
|
||||
|
||||
@ -142,10 +142,10 @@ class LawPermissionCheckerTest extends TestCase
|
||||
public function testGetRightsByType(): void
|
||||
{
|
||||
$right = $this->getClonedClientRight();
|
||||
$right->setType(RightType::WRITE);
|
||||
$right->setType(CRUDType::UPDATE);
|
||||
$this->law->getRights()->add($right);
|
||||
$this->assertFalse($this->checkClientPermission());
|
||||
$right->setType(RightType::READ);
|
||||
$right->setType(CRUDType::READ);
|
||||
$this->assertTrue($this->checkClientPermission());
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ use App\Entity\Meta\Right;
|
||||
use FOS\RestBundle\View\ViewHandlerInterface;
|
||||
use App\Entity\Source\PureSource;
|
||||
use App\DBAL\Types\SystemSlugType;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Domain\ResponseManagement\SourceRESTResponseManager;
|
||||
use App\Exception\AllreadyDefinedException;
|
||||
|
||||
@ -67,7 +67,7 @@ class SourceRESTReponseManagerTest extends KernelTestCase
|
||||
$requestedRight->setSource($requestedSource);
|
||||
$requestedRight->setReciever(new PureSource());
|
||||
$requestedRight->setLayer(LayerType::SOURCE);
|
||||
$requestedRight->setType(RightType::READ);
|
||||
$requestedRight->setType(CRUDType::READ);
|
||||
$this->expectException(AllreadyDefinedException::class);
|
||||
$sourceResponseManager = new SourceRESTResponseManager(null, $this->entityManager, $requestedRight, $this->viewHandler);
|
||||
$sourceResponseManager->getResponse();
|
||||
|
@ -6,10 +6,10 @@ use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\Domain\RightManagement\RightCheckerInterface;
|
||||
use App\Domain\RightManagement\RightChecker;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Entity\Source\PureSource;
|
||||
|
||||
class RightCheckerTest extends TestCase
|
||||
@ -42,7 +42,7 @@ class RightCheckerTest extends TestCase
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->layer = LayerType::RELATION;
|
||||
$this->type = RightType::READ;
|
||||
$this->type = CRUDType::READ;
|
||||
$this->source = new PureSource();
|
||||
$this->right = new Right();
|
||||
$this->right->setReciever($this->source);
|
||||
@ -57,7 +57,7 @@ class RightCheckerTest extends TestCase
|
||||
$this->assertTrue($granted);
|
||||
$notGranted = $this->rightManager->isGranted(LayerType::SOURCE, $this->type, $this->source);
|
||||
$this->assertFalse($notGranted);
|
||||
$notGranted2 = $this->rightManager->isGranted($this->layer, RightType::WRITE, $this->source);
|
||||
$notGranted2 = $this->rightManager->isGranted($this->layer, CRUDType::UPDATE, $this->source);
|
||||
$this->assertFalse($notGranted2);
|
||||
$this->right->setGrant(false);
|
||||
$notGranted3 = $this->rightManager->isGranted($this->layer, $this->type, $this->source);
|
||||
@ -74,7 +74,7 @@ class RightCheckerTest extends TestCase
|
||||
$this->assertTrue($granted);
|
||||
$notGranted = $this->rightManager->isGranted(LayerType::SOURCE, $this->type, $secondSource);
|
||||
$this->assertFalse($notGranted);
|
||||
$notGranted2 = $this->rightManager->isGranted($this->layer, RightType::WRITE, $secondSource);
|
||||
$notGranted2 = $this->rightManager->isGranted($this->layer, CRUDType::UPDATE, $secondSource);
|
||||
$this->assertFalse($notGranted2);
|
||||
$this->right->setGrant(false);
|
||||
$notGranted3 = $this->rightManager->isGranted($this->layer, $this->type, $secondSource);
|
||||
@ -91,7 +91,7 @@ class RightCheckerTest extends TestCase
|
||||
$this->assertTrue($granted);
|
||||
$notGranted = $this->rightManager->isGranted(LayerType::SOURCE, $this->type, $thirdSource);
|
||||
$this->assertFalse($notGranted);
|
||||
$notGranted2 = $this->rightManager->isGranted($this->layer, RightType::WRITE, $thirdSource);
|
||||
$notGranted2 = $this->rightManager->isGranted($this->layer, CRUDType::UPDATE, $thirdSource);
|
||||
$this->assertFalse($notGranted2);
|
||||
$this->right->setGrant(false);
|
||||
$notGranted3 = $this->rightManager->isGranted($this->layer, $this->type, $thirdSource);
|
||||
|
@ -10,8 +10,8 @@ use App\Domain\SecureLoadManagement\SecureSourceLoader;
|
||||
use App\Entity\Source\Primitive\Text\TextSource;
|
||||
use App\DBAL\Types\SystemSlugType;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Entity\Source\Complex\UserSource;
|
||||
use App\Entity\Source\Primitive\Text\TextSourceInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@ -52,7 +52,7 @@ class SecureSourceLoaderTest extends KernelTestCase
|
||||
$requestedRight = new Right();
|
||||
$requestedRight->setSource($requestedSource);
|
||||
$requestedRight->setLayer(LayerType::SOURCE);
|
||||
$requestedRight->setType(RightType::READ);
|
||||
$requestedRight->setType(CRUDType::READ);
|
||||
$requestedRight->setReciever(new UserSource());
|
||||
$secureSourceLoader = new SecureSourceLoader($this->entityManager, $requestedRight);
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
@ -66,7 +66,7 @@ class SecureSourceLoaderTest extends KernelTestCase
|
||||
$requestedRight = new Right();
|
||||
$requestedRight->setSource($requestedSource);
|
||||
$requestedRight->setLayer(LayerType::SOURCE);
|
||||
$requestedRight->setType(RightType::READ);
|
||||
$requestedRight->setType(CRUDType::READ);
|
||||
$requestedRight->setReciever($this->sourceRepository->findOneBySlug(SystemSlugType::GUEST_USER));
|
||||
$secureSourceLoader = new SecureSourceLoader($this->entityManager, $requestedRight);
|
||||
$this->assertInstanceOf(TextSourceInterface::class, $secureSourceLoader->getSource());
|
||||
|
@ -8,8 +8,8 @@ use App\Domain\SecureManagement\SecureSourceCheckerInterface;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
use App\Domain\SecureManagement\SecureSourceChecker;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Entity\Attribut\SourceAttribut;
|
||||
use App\Entity\Attribut\SourceAttributInterface;
|
||||
use App\Exception\SourceAccessDenied;
|
||||
@ -52,13 +52,13 @@ class SecureSourceCheckerTest extends TestCase
|
||||
{
|
||||
$right = new Right();
|
||||
$right->setLayer(LayerType::SOURCE);
|
||||
$right->setType(RightType::WRITE);
|
||||
$right->setType(CRUDType::UPDATE);
|
||||
$right->setReciever($this->recieverSource);
|
||||
$right->setSource($this->source);
|
||||
$this->source->getLaw()->getRights()->add($right);
|
||||
$requestedRight = clone $right;
|
||||
$this->assertTrue($this->securerSourceChecker->hasPermission($requestedRight));
|
||||
$requestedRight->setType(RightType::READ);
|
||||
$requestedRight->setType(CRUDType::READ);
|
||||
$this->assertFalse($this->securerSourceChecker->hasPermission($requestedRight));
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class SecureSourceCheckerTest extends TestCase
|
||||
{
|
||||
$right = new Right();
|
||||
$right->setLayer(LayerType::SOURCE);
|
||||
$right->setType(RightType::WRITE);
|
||||
$right->setType(CRUDType::UPDATE);
|
||||
$right->setReciever($this->recieverSource);
|
||||
$right->setSource($this->source);
|
||||
$this->source->getLaw()->getRights()->add($right);
|
||||
@ -76,7 +76,7 @@ class SecureSourceCheckerTest extends TestCase
|
||||
$this->source->setSource($attributSource);
|
||||
$requestedRight = clone $right;
|
||||
$this->assertTrue($this->securerSourceChecker->hasPermission($requestedRight));
|
||||
$childRight->setType(RightType::READ);
|
||||
$childRight->setType(CRUDType::READ);
|
||||
$this->expectException(SourceAccessDenied::class);
|
||||
$this->securerSourceChecker->hasPermission($requestedRight);
|
||||
}
|
||||
@ -85,7 +85,7 @@ class SecureSourceCheckerTest extends TestCase
|
||||
{
|
||||
$right = new Right();
|
||||
$right->setLayer(LayerType::SOURCE);
|
||||
$right->setType(RightType::WRITE);
|
||||
$right->setType(CRUDType::UPDATE);
|
||||
$right->setReciever($this->recieverSource);
|
||||
$right->setSource($this->source);
|
||||
$this->source->getLaw()->getRights()->add($right);
|
||||
@ -98,7 +98,7 @@ class SecureSourceCheckerTest extends TestCase
|
||||
$attribut1Source->setSource($attribut2Source);
|
||||
$requestedRight = clone $right;
|
||||
$this->assertTrue($this->securerSourceChecker->hasPermission($requestedRight));
|
||||
$childRight->setType(RightType::READ);
|
||||
$childRight->setType(CRUDType::READ);
|
||||
$this->expectException(SourceAccessDenied::class);
|
||||
$this->securerSourceChecker->hasPermission($requestedRight);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace Tests\Unit\Entity\Attribut;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Attribut\LayerAttributInterface;
|
||||
use App\Entity\Attribut\LayerAttribut;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
|
||||
class LayerAttributTest extends TestCase
|
||||
{
|
||||
|
@ -3,11 +3,11 @@
|
||||
namespace tests\unit\Entity;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\Entity\Meta\Law;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\Exception\NoValidChoiceException;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
|
||||
@ -73,7 +73,7 @@ class RightTest extends TestCase
|
||||
|
||||
public function testRight(): void
|
||||
{
|
||||
foreach (RightType::getChoices() as $key => $value) {
|
||||
foreach (CRUDType::getChoices() as $key => $value) {
|
||||
$this->assertNull($this->right->setType($key));
|
||||
$this->assertEquals($key, $this->right->getType());
|
||||
}
|
||||
@ -99,7 +99,7 @@ class RightTest extends TestCase
|
||||
$source = $this->createMock(AbstractSource::class);
|
||||
$reciever = $this->createMock(AbstractSource::class);
|
||||
$grant = false;
|
||||
$type = RightType::READ;
|
||||
$type = CRUDType::READ;
|
||||
$layer = LayerType::SOURCE;
|
||||
$this->right->setSource($source);
|
||||
$this->right->setReciever($reciever);
|
||||
|
@ -6,8 +6,8 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Entity\Meta\Law;
|
||||
use App\Entity\Meta\LawInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@ -56,7 +56,7 @@ class RightRepositoryTest extends KernelTestCase
|
||||
$this->right = new Right();
|
||||
$this->right->setPriority(self::PRIORITY);
|
||||
$this->right->setLayer(LayerType::SOURCE);
|
||||
$this->right->setType(RightType::READ);
|
||||
$this->right->setType(CRUDType::READ);
|
||||
$this->law = new Law();
|
||||
$this->entityManager->persist($this->law);
|
||||
$this->right->setLaw($this->law);
|
||||
|
Loading…
Reference in New Issue
Block a user