|
@@ -45,6 +45,7 @@ final class ArticleController extends AbstractController
|
|
}
|
|
}
|
|
|
|
|
|
#[Route('/{id}', name: 'app_article_show', methods: ['GET'])]
|
|
#[Route('/{id}', name: 'app_article_show', methods: ['GET'])]
|
|
|
|
+ #[IsGranted('view', 'article')]
|
|
public function show(Article $article): Response
|
|
public function show(Article $article): Response
|
|
{
|
|
{
|
|
return $this->render('article/show.html.twig', [
|
|
return $this->render('article/show.html.twig', [
|
|
@@ -53,6 +54,7 @@ final class ArticleController extends AbstractController
|
|
}
|
|
}
|
|
|
|
|
|
#[Route('/{id}/edit', name: 'app_article_edit', methods: ['GET', 'POST'])]
|
|
#[Route('/{id}/edit', name: 'app_article_edit', methods: ['GET', 'POST'])]
|
|
|
|
+ #[IsGranted('edit', 'article')]
|
|
public function edit(Request $request, Article $article, EntityManagerInterface $entityManager): Response
|
|
public function edit(Request $request, Article $article, EntityManagerInterface $entityManager): Response
|
|
{
|
|
{
|
|
$form = $this->createForm(ArticleType::class, $article);
|
|
$form = $this->createForm(ArticleType::class, $article);
|
|
@@ -71,6 +73,7 @@ final class ArticleController extends AbstractController
|
|
}
|
|
}
|
|
|
|
|
|
#[Route('/{id}', name: 'app_article_delete', methods: ['POST'])]
|
|
#[Route('/{id}', name: 'app_article_delete', methods: ['POST'])]
|
|
|
|
+ #[IsGranted('edit', 'article')]
|
|
public function delete(Request $request, Article $article, EntityManagerInterface $entityManager): Response
|
|
public function delete(Request $request, Article $article, EntityManagerInterface $entityManager): Response
|
|
{
|
|
{
|
|
if ($this->isCsrfTokenValid('delete'.$article->getId(), $request->getPayload()->getString('_token'))) {
|
|
if ($this->isCsrfTokenValid('delete'.$article->getId(), $request->getPayload()->getString('_token'))) {
|