Renamed TypeAttribut to CrudAttribut

This commit is contained in:
Kevin Frantz
2019-01-16 21:22:18 +01:00
parent 665f0044cc
commit 93bf246915
28 changed files with 113 additions and 107 deletions

View File

@@ -49,9 +49,9 @@ final class LawPermissionCheckerService implements LawPermissionCheckerServiceIn
*
* @return Collection|RightInterface[]
*/
private function getRightsByType(Collection $rights, string $type): Collection
private function getRightsByCrud(Collection $rights, string $type): Collection
{
return $this->getFilteredRights($rights, $type, 'Type');
return $this->getFilteredRights($rights, $type, 'Crud');
}
/**
@@ -139,7 +139,7 @@ final class LawPermissionCheckerService implements LawPermissionCheckerServiceIn
$right = $rights[0];
$rightChecker = new RightChecker($right);
return $rightChecker->isGranted($client->getLayer(), $client->getType(), $client->getReciever());
return $rightChecker->isGranted($client->getLayer(), $client->getCrud(), $client->getReciever());
}
public function __construct(LawInterface $law)
@@ -150,7 +150,7 @@ final class LawPermissionCheckerService implements LawPermissionCheckerServiceIn
public function hasPermission(RightInterface $clientRight): bool
{
$rights = clone $this->law->getRights();
$rights = $this->getRightsByType($rights, $clientRight->getType());
$rights = $this->getRightsByCrud($rights, $clientRight->getCrud());
$rights = $this->getRightsByLayer($rights, $clientRight->getLayer());
$rights = $this->getRightsByReciever($rights, $clientRight->getReciever());
$rights = $this->sortByPriority($rights);

View File

@@ -3,7 +3,7 @@
namespace App\Domain\RequestManagement;
use App\Entity\Source\SourceInterface;
use App\Entity\Attribut\TypeAttribut;
use App\Entity\Attribut\CrudAttribut;
use App\Entity\Attribut\LayerAttribut;
use App\Entity\Attribut\RecieverAttribut;
use App\Exception\PreconditionFailedException;
@@ -17,7 +17,7 @@ use App\Repository\Source\SourceRepositoryInterface;
*/
class RequestedRight implements RequestedRightInterface
{
use TypeAttribut, LayerAttribut, RecieverAttribut;
use CrudAttribut, LayerAttribut, RecieverAttribut;
/**
* @var SourceRepositoryInterface

View File

@@ -2,7 +2,7 @@
namespace App\Domain\RequestManagement;
use App\Entity\Attribut\TypeAttributInterface;
use App\Entity\Attribut\CrudAttributInterface;
use App\Entity\Attribut\RecieverAttributInterface;
use App\Entity\Attribut\LayerAttributInterface;
use App\Entity\Source\SourceInterface;
@@ -10,7 +10,7 @@ use App\Entity\Source\SourceInterface;
/**
* @author kevinfrantz
*/
interface RequestedRightInterface extends TypeAttributInterface, RecieverAttributInterface, LayerAttributInterface
interface RequestedRightInterface extends CrudAttributInterface, RecieverAttributInterface, LayerAttributInterface
{
/**
* @param RequestedSourceInterface $requestedSource

View File

@@ -63,11 +63,11 @@ final class RequestedUserRightFacade implements RequestedUserRightFacadeInterfac
/**
* {@inheritdoc}
*
* @see \App\Entity\Attribut\TypeAttributInterface::getType()
* @see \App\Entity\Attribut\CrudAttributInterface::getCrud()
*/
public function getType(): string
public function getCrud(): string
{
return $this->requestedRight->getType();
return $this->requestedRight->getCrud();
}
/**
@@ -93,11 +93,11 @@ final class RequestedUserRightFacade implements RequestedUserRightFacadeInterfac
/**
* {@inheritdoc}
*
* @see \App\Entity\Attribut\TypeAttributInterface::setType()
* @see \App\Entity\Attribut\CrudAttributInterface::setCrud()
*/
public function setType(string $type): void
public function setCrud(string $type): void
{
$this->requestedRight->setType($type);
$this->requestedRight->setCrud($type);
}
/**

View File

@@ -45,7 +45,7 @@ final class RightChecker implements RightCheckerInterface
private function isTypeEqual(string $type): bool
{
return $this->right->getType() === $type;
return $this->right->getCrud() === $type;
}
private function checkPermission(): bool

View File

@@ -51,7 +51,7 @@ final class SecureCRUDFactoryService extends AbstractSecureCRUDService implement
*/
public function create(RightInterface $requestedRight): SecureCRUDServiceInterface
{
$namespace = $this->getCRUDNamespace($requestedRight->getLayer(), $requestedRight->getType());
$namespace = $this->getCRUDNamespace($requestedRight->getLayer(), $requestedRight->getCrud());
return new $namespace($this->requestStack, $this->security, $this->entityManager);
}

View File

@@ -119,9 +119,9 @@ final class TemplatePathInformation implements TemplatePathInformationInterface
/**
* {@inheritdoc}
*
* @see \App\Domain\TemplateManagement\TemplatePathInformationInterface::getType()
* @see \App\Domain\TemplateManagement\TemplatePathInformationInterface::getCrud()
*/
public function getType(): string
public function getCrud(): string
{
return $this->type;
}

View File

@@ -26,5 +26,5 @@ interface TemplatePathInformationInterface extends ReloadTypeInterface
*
* @return string Type of the template
*/
public function getType(): string;
public function getCrud(): string;
}