2019-01-13 17:02:15 +01:00
|
|
|
<?php
|
|
|
|
|
2019-01-20 12:54:56 +01:00
|
|
|
namespace App\Domain\RequestManagement\User;
|
2019-01-13 17:02:15 +01:00
|
|
|
|
|
|
|
use App\Entity\Source\SourceInterface;
|
|
|
|
use App\Domain\UserManagement\UserSourceDirectorInterface;
|
2019-01-15 22:57:54 +01:00
|
|
|
use App\Exception\SetNotPossibleException;
|
2019-01-20 12:54:56 +01:00
|
|
|
use App\Domain\RequestManagement\Right\RequestedRightInterface;
|
|
|
|
use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
|
2019-01-13 17:02:15 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
2019-01-20 12:54:56 +01:00
|
|
|
class RequestedUser implements RequestedUserInterface
|
2019-01-13 17:02:15 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var UserSourceDirectorInterface
|
|
|
|
*/
|
|
|
|
private $userSourceDirector;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var RequestedRightInterface
|
|
|
|
*/
|
|
|
|
private $requestedRight;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param UserSourceDirectorInterface $userSourceDirector
|
|
|
|
*/
|
|
|
|
public function __construct(UserSourceDirectorInterface $userSourceDirector, RequestedRightInterface $requestedRight)
|
|
|
|
{
|
|
|
|
$this->userSourceDirector = $userSourceDirector;
|
|
|
|
$this->requestedRight = $requestedRight;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-01-20 10:41:58 +01:00
|
|
|
* @see \App\Attribut\RecieverAttributInterface::setReciever()
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
|
|
|
public function setReciever(SourceInterface $reciever): void
|
|
|
|
{
|
2019-01-15 22:57:54 +01:00
|
|
|
throw new SetNotPossibleException('It\'s not possible to set the reciever!');
|
2019-01-13 17:02:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-01-20 10:41:58 +01:00
|
|
|
* @see \App\Attribut\RecieverAttributInterface::getReciever()
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
|
|
|
public function getReciever(): SourceInterface
|
|
|
|
{
|
|
|
|
return $this->userSourceDirector->getUser()->getSource();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-01-20 10:41:58 +01:00
|
|
|
* @see \App\Attribut\LayerAttributInterface::setLayer()
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
|
|
|
public function setLayer(string $layer): void
|
|
|
|
{
|
|
|
|
$this->requestedRight->setLayer($layer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-01-20 10:41:58 +01:00
|
|
|
* @see \App\Attribut\CrudAttributInterface::getCrud()
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
2019-01-16 21:22:18 +01:00
|
|
|
public function getCrud(): string
|
2019-01-13 17:02:15 +01:00
|
|
|
{
|
2019-01-16 21:22:18 +01:00
|
|
|
return $this->requestedRight->getCrud();
|
2019-01-13 17:02:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-01-20 10:41:58 +01:00
|
|
|
* @see \App\Attribut\LayerAttributInterface::getLayer()
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
|
|
|
public function getLayer(): string
|
|
|
|
{
|
|
|
|
return $this->requestedRight->getLayer();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-01-20 10:41:58 +01:00
|
|
|
* @see \App\Attribut\SourceAttributInterface::getSource()
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
|
|
|
public function getSource(): SourceInterface
|
|
|
|
{
|
|
|
|
return $this->requestedRight->getSource();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-01-20 10:41:58 +01:00
|
|
|
* @see \App\Attribut\CrudAttributInterface::setCrud()
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
2019-01-16 21:22:18 +01:00
|
|
|
public function setCrud(string $type): void
|
2019-01-13 17:02:15 +01:00
|
|
|
{
|
2019-01-16 21:22:18 +01:00
|
|
|
$this->requestedRight->setCrud($type);
|
2019-01-13 17:02:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-01-20 12:54:56 +01:00
|
|
|
* @param RequestedEntityInterface $requestedSource
|
2019-01-13 17:02:15 +01:00
|
|
|
*/
|
2019-01-20 11:33:05 +01:00
|
|
|
public function setRequestedEntity(RequestedEntityInterface $requestedSource): void
|
2019-01-13 17:02:15 +01:00
|
|
|
{
|
2019-01-20 12:54:56 +01:00
|
|
|
$this->requestedRight->setRequestedEntity($requestedSource);
|
2019-01-13 17:02:15 +01:00
|
|
|
}
|
|
|
|
}
|