setSource($source); return $requestedRight; } /** * {@inheritdoc} * * @see \App\Domain\SecureCRUDManagement\AbstractSecureCRUDService::__construct() */ public function __construct(RequestStack $requestStack, Security $security, EntityManagerInterface $entityManager) { $this->sourceRepository = $entityManager->getRepository(AbstractSource::class); parent::__construct($requestStack, $security, $entityManager); } /** * @todo This will not work! Change interface to requested right! * * @param RightInterface $requestedRight * * @return EntityInterface */ public function read(RightInterface $requestedRight): EntityInterface { $source = $requestedRight->getSource(); $requestedRight = $this->getClonedRightWithModifiedSource($source, $requestedRight); $secureSourceChecker = new SecureSourceChecker($source); if ($secureSourceChecker->hasPermission($requestedRight)) { return $source; } throw new SourceAccessDenied(); } }