Optimized draft for UserSourceDirector and UserRight

This commit is contained in:
Kevin Frantz
2019-01-13 14:00:16 +01:00
parent 1dc428bcfd
commit 2837df25f8
12 changed files with 108 additions and 100 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Domain\RightManagement;
use App\Entity\Meta\Right;
use App\Entity\Source\SourceInterface;
use App\Exception\SetNotPossibleException;
use App\Domain\UserManagement\UserSourceDirectorInterface;
/**
* @author kevinfrantz
*/
final class UserRight extends Right implements UserRightInterface
{
/**
* @var UserSourceDirectorInterface
*/
private $userSourceDirector;
/**
* @param UserSourceDirectorInterface $userSourceDirector
*/
public function __construct(UserSourceDirectorInterface $userSourceDirector)
{
$this->userSourceDirector = $userSourceDirector;
}
/**
* {@inheritdoc}
*
* @see \App\Entity\Attribut\RecieverAttributInterface::setReciever()
*/
public function setReciever(SourceInterface $reciever): void
{
throw new SetNotPossibleException('This class doesn\'t allow to set a reciever!');
}
/**
* {@inheritdoc}
*
* @see \App\Entity\Attribut\RecieverAttributInterface::getReciever()
*/
public function getReciever(): SourceInterface
{
return $this->userSourceDirector->getUser()->getSource();
}
}

View File

@@ -1,14 +1,14 @@
<?php
namespace App\Domain\RightManagement;
use App\Entity\Meta\RightInterface;
/**
* Offers a Service for managing the rights
* @author kevinfrantz
* Offers a Service for managing the rights.
*
* @author kevinfrantz
*/
interface UserRightServiceInterface extends RightInterface
interface UserRightInterface extends RightInterface
{
}

View File

@@ -1,41 +0,0 @@
<?php
namespace App\Domain\RightManagement;
use App\Entity\Meta\Right;
use App\Entity\UserInterface as InfinitoUserInterface;
use App\Entity\Source\SourceInterface;
use App\Entity\UserInterface;
use Symfony\Component\Security\Core\Security;
/**
*
* @author kevinfrantz
*
*/
final class UserRightService extends Right implements UserRightServiceInterface
{
/**
*
* @var Security
*/
private $security;
public function __construct(Security $security)
{
$this->security = $security;
}
/**
* {@inheritDoc}
* @see \App\Entity\Attribut\RecieverAttributInterface::setReciever()
*/
public function setReciever(SourceInterface $reciever):void{
}
public function getReciever():SourceInterface{
return $this->user->getSource();
}
}