Files
vision/src/Controller/ShareController.php
Xbird 9f22f5b1ee V-Beta-1.0.0
Vision is out of alpha !
2022-02-02 17:46:29 +01:00

28 lines
793 B
PHP

<?php
namespace App\Controller;
use App\Entity\Document;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
class ShareController extends AbstractController
{
#[Route('/share/{share}', name: 'share')]
public function share(Document $Document): Response
{
if (!$Document->getAllowShare()) {
throw new AccessDeniedHttpException('granted_not_allowed_viewing_document');
}
return $this->render('document/view.html.twig', [
'controller_name' => 'DocumentController',
'document' => $Document,
'shared' => true
]);
}
}