2018-09-22 02:12:03 +02:00
|
|
|
<?php
|
2018-10-29 19:01:00 +01:00
|
|
|
|
2018-09-22 02:12:03 +02:00
|
|
|
namespace App\Structur\Facade\Security\Source;
|
|
|
|
|
2018-10-28 20:28:29 +01:00
|
|
|
use App\Entity\Meta\LawInterface;
|
2018-10-03 16:14:15 +02:00
|
|
|
use App\Entity\Source\NameSourceInterface;
|
2018-10-27 14:56:26 +02:00
|
|
|
use App\Entity\Source\SourceInterface;
|
2018-10-03 16:14:15 +02:00
|
|
|
use App\Entity\UserInterface;
|
|
|
|
use App\Entity\Source\UserSourceInterface;
|
2018-09-22 02:12:03 +02:00
|
|
|
use App\DBAL\Types\RightType;
|
|
|
|
use App\DBAL\Types\LayerType;
|
2018-10-27 14:56:26 +02:00
|
|
|
use Doctrine\Common\Collections\Collection;
|
2018-09-22 02:12:03 +02:00
|
|
|
|
|
|
|
/**
|
2018-10-28 20:28:29 +01:00
|
|
|
* @todo check if this layer makes sense
|
2018-10-29 19:01:00 +01:00
|
|
|
*
|
2018-09-22 02:12:03 +02:00
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var UserSourceInterface
|
|
|
|
*/
|
|
|
|
protected $source;
|
|
|
|
|
|
|
|
public function setNameSource(NameSourceInterface $nameSource): void
|
|
|
|
{
|
|
|
|
throw new \Exception('The name source cant be changed!');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getNameSource(): NameSourceInterface
|
|
|
|
{
|
|
|
|
if ($this->isNameSourceGranted(RightType::READ, LayerType::SOURCE)) {
|
2018-10-25 20:42:52 +02:00
|
|
|
// FILL! :)
|
2018-09-22 02:12:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function isNameSourceGranted(string $right, string $layer): bool
|
|
|
|
{
|
|
|
|
$nameSource = $this->source->getNameSource();
|
|
|
|
$law = $nameSource->getNode()->getLaw();
|
|
|
|
$userSourceNode = $this->source->getNode();
|
|
|
|
|
|
|
|
return $this->isGranted($right, $layer) && $law->isGranted($userSourceNode, $layer, $right);
|
|
|
|
}
|
2018-10-25 20:42:52 +02:00
|
|
|
|
2018-10-03 16:14:15 +02:00
|
|
|
public function getUser(): UserInterface
|
2018-10-29 19:01:00 +01:00
|
|
|
{
|
|
|
|
}
|
2018-09-22 02:12:03 +02:00
|
|
|
|
2018-10-03 16:14:15 +02:00
|
|
|
public function setUser(UserInterface $user): void
|
2018-10-29 19:01:00 +01:00
|
|
|
{
|
|
|
|
}
|
2018-09-24 17:12:48 +02:00
|
|
|
|
2018-10-25 20:42:52 +02:00
|
|
|
public function getVersion(): int
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
2018-10-25 20:42:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setVersion(int $version): void
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
2018-10-25 20:42:52 +02:00
|
|
|
}
|
2018-10-27 14:56:26 +02:00
|
|
|
|
|
|
|
public function setSource(SourceInterface $source): void
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
2018-10-27 14:56:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getGroupSources(): Collection
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
2018-10-27 14:56:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getSource(): SourceInterface
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
2018-10-27 14:56:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setGroupSources(Collection $groups): void
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
2018-10-27 14:56:26 +02:00
|
|
|
}
|
2018-10-29 19:01:00 +01:00
|
|
|
|
2018-10-28 20:28:29 +01:00
|
|
|
public function setLaw(LawInterface $law): void
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
2018-10-28 20:28:29 +01:00
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLaw(): LawInterface
|
|
|
|
{
|
2018-10-29 19:01:00 +01:00
|
|
|
/*
|
2018-10-28 20:28:29 +01:00
|
|
|
*
|
|
|
|
* @todo Implement
|
|
|
|
*/
|
|
|
|
}
|
2018-09-22 02:12:03 +02:00
|
|
|
}
|