mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Optimized draft for UserSourceDirector and UserRight
This commit is contained in:
47
application/symfony/src/Domain/RightManagement/UserRight.php
Normal file
47
application/symfony/src/Domain/RightManagement/UserRight.php
Normal 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();
|
||||
}
|
||||
}
|
@@ -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
|
||||
{
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user