for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\MediaBundle\Security;
use Sonata\MediaBundle\Model\MediaInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\TranslatorInterface;
/**
* @final since sonata-project/media-bundle 3.21.0
class ForbiddenDownloadStrategy implements DownloadStrategyInterface
{
* @var TranslatorInterface
protected $translator;
public function __construct(TranslatorInterface $translator)
$this->translator = $translator;
}
public function isGranted(MediaInterface $media, Request $request)
return false;
public function getDescription()
return $this->translator->trans('description.forbidden_download_strategy', [], 'SonataMediaBundle');