mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 06:27:24 +01:00
Added comments
This commit is contained in:
parent
727a5c2aaf
commit
4a40f78e7d
@ -142,11 +142,19 @@ final class LawPermissionCheckerService implements LawPermissionCheckerServiceIn
|
|||||||
return $rightChecker->isGranted($client->getLayer(), $client->getCrud(), $client->getReciever());
|
return $rightChecker->isGranted($client->getLayer(), $client->getCrud(), $client->getReciever());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LawInterface $law
|
||||||
|
*/
|
||||||
public function __construct(LawInterface $law)
|
public function __construct(LawInterface $law)
|
||||||
{
|
{
|
||||||
$this->law = $law;
|
$this->law = $law;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \App\Domain\LawManagement\LawPermissionCheckerServiceInterface::hasPermission()
|
||||||
|
*/
|
||||||
public function hasPermission(RightInterface $clientRight): bool
|
public function hasPermission(RightInterface $clientRight): bool
|
||||||
{
|
{
|
||||||
$rights = clone $this->law->getRights();
|
$rights = clone $this->law->getRights();
|
||||||
|
@ -33,26 +33,47 @@ final class RightChecker implements RightCheckerInterface
|
|||||||
return $allSourcesToWhichRightApplies;
|
return $allSourcesToWhichRightApplies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SourceInterface $clientSource
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function hasClientSource(SourceInterface $clientSource): bool
|
private function hasClientSource(SourceInterface $clientSource): bool
|
||||||
{
|
{
|
||||||
return $this->getAllSourcesToWhichRightApplies()->contains($clientSource);
|
return $this->getAllSourcesToWhichRightApplies()->contains($clientSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $layer
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function isLayerEqual(string $layer): bool
|
private function isLayerEqual(string $layer): bool
|
||||||
{
|
{
|
||||||
return $this->right->getLayer() === $layer;
|
return $this->right->getLayer() === $layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function isTypeEqual(string $type): bool
|
private function isTypeEqual(string $type): bool
|
||||||
{
|
{
|
||||||
return $this->right->getCrud() === $type;
|
return $this->right->getCrud() === $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function checkPermission(): bool
|
private function checkPermission(): bool
|
||||||
{
|
{
|
||||||
return $this->right->getGrant();
|
return $this->right->getGrant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param RightInterface $right
|
||||||
|
*/
|
||||||
public function __construct(RightInterface $right)
|
public function __construct(RightInterface $right)
|
||||||
{
|
{
|
||||||
$this->right = $right;
|
$this->right = $right;
|
||||||
|
@ -4,7 +4,17 @@ namespace App\Domain\RightManagement;
|
|||||||
|
|
||||||
use App\Entity\Source\SourceInterface;
|
use App\Entity\Source\SourceInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
interface RightCheckerInterface
|
interface RightCheckerInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param string $layer
|
||||||
|
* @param string $type
|
||||||
|
* @param SourceInterface $source
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function isGranted(string $layer, string $type, SourceInterface $source): bool;
|
public function isGranted(string $layer, string $type, SourceInterface $source): bool;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,9 @@ use App\Entity\Source\SourceInterface;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use App\Entity\Meta\Relation\Member\MemberRelationInterface;
|
use App\Entity\Meta\Relation\Member\MemberRelationInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
final class SourceMemberInformation implements SourceMemberInformationInterface
|
final class SourceMemberInformation implements SourceMemberInformationInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -19,6 +22,9 @@ final class SourceMemberInformation implements SourceMemberInformationInterface
|
|||||||
*/
|
*/
|
||||||
private $members;
|
private $members;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SourceInterface $source
|
||||||
|
*/
|
||||||
public function __construct(SourceInterface $source)
|
public function __construct(SourceInterface $source)
|
||||||
{
|
{
|
||||||
$this->source = $source;
|
$this->source = $source;
|
||||||
|
Loading…
Reference in New Issue
Block a user