mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Added grant to all function to RightChecker and LawPermissionChecker
This commit is contained in:
@@ -71,6 +71,24 @@ final class RightChecker implements RightCheckerInterface
|
||||
return $this->right->getGrant();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function doesRightApplyToAllSources(): bool
|
||||
{
|
||||
return !$this->right->hasReciever();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SourceInterface $source
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function doesRightApply(SourceInterface $source): bool
|
||||
{
|
||||
return $this->doesRightApplyToAllSources() || $this->hasClientSource($source);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RightInterface $right
|
||||
*/
|
||||
@@ -79,8 +97,13 @@ final class RightChecker implements RightCheckerInterface
|
||||
$this->right = $right;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\RightManagement\RightCheckerInterface::isGranted()
|
||||
*/
|
||||
public function isGranted(string $layer, string $type, SourceInterface $source): bool
|
||||
{
|
||||
return $this->isLayerEqual($layer) && $this->isTypeEqual($type) && $this->hasClientSource($source) && $this->checkPermission();
|
||||
return $this->isLayerEqual($layer) && $this->isTypeEqual($type) && $this->doesRightApply($source) && $this->checkPermission();
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,9 @@ use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
*/
|
||||
final class RightLayerCombinationService implements RightLayerCombinationServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
const EXLUDED_RIGHTS_BY_LAYER = [
|
||||
LayerType::HEREDITY => [
|
||||
CRUDType::CREATE,
|
||||
|
Reference in New Issue
Block a user