Social: Add security constraint in controller

pull/4161/head
Angel Fernando Quiroz Campos 3 years ago
parent 0a56d70fa2
commit 6db1773f1c
  1. 4
      src/CoreBundle/Controller/Api/AbstractFeedbackSocialPostController.php
  2. 2
      src/CoreBundle/Entity/SocialPost.php

@ -29,10 +29,6 @@ abstract class AbstractFeedbackSocialPostController extends AbstractController
) {
$this->currentUser = $this->security->getUser();
if (null === $this->currentUser) {
throw new AccessDeniedException();
}
if ('true' !== $this->settingsManager->getSetting('social.allow_social_tool')) {
throw new AccessDeniedException();
}

@ -58,6 +58,7 @@ use Symfony\Component\Validator\Constraints as Assert;
'controller' => LikeSocialPostController::class,
'denormalization_context' => ['groups' => []],
'normalization_context' => ['groups' => ['social_post_feedback']],
'security' => "is_granted('ROLE_USER')",
],
'post_dislike' => [
'method' => 'POST',
@ -65,6 +66,7 @@ use Symfony\Component\Validator\Constraints as Assert;
'controller' => DislikeSocialPostController::class,
'denormalization_context' => ['groups' => []],
'normalization_context' => ['groups' => ['social_post_feedback']],
'security' => "is_granted('ROLE_USER')",
],
],
attributes: [

Loading…
Cancel
Save