From f4698074127f6a3711b6b5182cd174c8ac6013cd Mon Sep 17 00:00:00 2001 From: Bastien Date: Wed, 11 Jan 2023 16:17:49 +0100 Subject: [PATCH] fix: security with the correct class in widgets --- src/Contracts/WidgetTypeInterface.php | 5 ----- src/Resources/config/services.yaml | 2 +- src/Widgets/AbstractWidget.php | 20 +++++++------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/Contracts/WidgetTypeInterface.php b/src/Contracts/WidgetTypeInterface.php index a495573..465398a 100755 --- a/src/Contracts/WidgetTypeInterface.php +++ b/src/Contracts/WidgetTypeInterface.php @@ -46,11 +46,6 @@ public function getType(); */ public function getName(); - /** - * @return array json schema for config - */ - public function getJsonSchema(); - /** * @return string returns widget title */ diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index c54204a..79880d5 100755 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -13,7 +13,7 @@ services: autowire: false autoconfigure: false calls: - - setSecurity: ['@security.authorization_checker'] + - setSecurity: ['@Symfony\Component\Security\Core\Security'] - setTwig: ['@twig'] - setFormFactory: ['@form.factory'] diff --git a/src/Widgets/AbstractWidget.php b/src/Widgets/AbstractWidget.php index 7a9f676..d70c090 100755 --- a/src/Widgets/AbstractWidget.php +++ b/src/Widgets/AbstractWidget.php @@ -7,7 +7,6 @@ use Lle\DashboardBundle\Form\Type\JsonType; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; -use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Security; use Twig\Environment; @@ -16,7 +15,7 @@ abstract class AbstractWidget implements WidgetTypeInterface /** * @var int */ - private int $id; + protected int $id; /** * @var int x position @@ -41,21 +40,21 @@ abstract class AbstractWidget implements WidgetTypeInterface /** * @var array json config */ - private ?array $config = null; + protected ?array $config = null; /** * @var string widget title */ - private ?string $title = null; + protected ?string $title = null; /** * @var Security */ - private AuthorizationCheckerInterface $security; + protected Security $security; - private Environment $twig; + protected Environment $twig; - private FormFactoryInterface $formFactory; + protected FormFactoryInterface $formFactory; public function getId() { @@ -148,11 +147,6 @@ public function getTitle() return $this->title; } - public function getJsonSchema() - { - return null; - } - /** * @inheritdoc */ @@ -243,7 +237,7 @@ public function twig($template, array $context = []): string /** * @required */ - public function setSecurity(AuthorizationCheckerInterface $security): self + public function setSecurity(Security $security): self { $this->security = $security;