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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user