From dbae57660b92836116a36726e18a653d854ed713 Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Tue, 24 Sep 2024 13:19:54 +0000 Subject: [PATCH] Merge branch hotfix/v2.3.28 --- LICENSE.md | 2 +- README.md | 2 + composer.json | 15 +- config/packages/roadiz_rozier.yaml | 1 + config/routing.yaml | 4 - config/services.yaml | 3 + phpstan.neon | 6 +- src/Aliases.php | 6 +- .../Document/DocumentArchiveController.php | 17 +-- .../Document/DocumentDuplicatesController.php | 10 +- .../DocumentLimitationsController.php | 10 +- .../Document/DocumentPublicListController.php | 2 +- .../Document/DocumentUnusedController.php | 14 +- .../Login/LoginRequestController.php | 23 +-- src/Controller/Node/RealmNodeController.php | 21 +-- src/Controller/Node/SeoController.php | 8 +- src/Controller/Node/TranslateController.php | 8 +- src/Controller/PingController.php | 10 +- src/Controller/SecurityController.php | 25 ++-- .../Compiler/RozierPathsCompilerPass.php | 2 - src/DependencyInjection/Configuration.php | 7 + .../RoadizRozierExtension.php | 7 +- src/Form/CustomFormType.php | 121 --------------- src/Form/DocumentTranslationType.php | 53 ------- src/Form/NodesTagsType.php | 8 +- src/ListManager/SessionListFilters.php | 61 -------- templates/custom-forms/usage.html.twig | 6 +- templates/nodes/actionsMenu.html.twig | 2 +- templates/security/login.html.twig | 1 + templates/simple.html.twig | 21 +-- translations/custom-forms/messages.en.xlf | 140 ++++++++++++++++++ translations/custom-forms/messages.fr.xlf | 140 ++++++++++++++++++ translations/custom-forms/messages.xlf | 140 ++++++++++++++++++ translations/helps/messages.ar.xlf | 1 - translations/helps/messages.de.xlf | 1 - translations/helps/messages.en.xlf | 3 - translations/helps/messages.es.xlf | 1 - translations/helps/messages.fr.xlf | 3 - translations/helps/messages.id.xlf | 3 - translations/helps/messages.it.xlf | 1 - translations/helps/messages.ru.xlf | 1 - translations/helps/messages.sr.xlf | 1 - translations/helps/messages.tr.xlf | 1 - translations/helps/messages.uk.xlf | 1 - translations/helps/messages.xlf | 3 - translations/helps/messages.zh.xlf | 3 - 46 files changed, 515 insertions(+), 404 deletions(-) delete mode 100644 src/Form/CustomFormType.php delete mode 100644 src/Form/DocumentTranslationType.php delete mode 100644 src/ListManager/SessionListFilters.php diff --git a/LICENSE.md b/LICENSE.md index 747e48b..01cd777 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright © 2023 Ambroise Maupate, Julien Blanchet +Copyright © 2024 Ambroise Maupate, Julien Blanchet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 00ab416..3503e87 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ roadiz_rozier: open_id: # Verify User info in JWT at each login verify_user_info: false + # Force generating redirect uri with https scheme. (required by some OpenID providers) + force_ssl_on_redirect_uri: true # Standard OpenID autodiscovery URL, required to enable OpenId login in Roadiz CMS. discovery_url: '%env(string:OPEN_ID_DISCOVERY_URL)%' # For public identity providers (such as Google), restrict users emails by their domain. diff --git a/composer.json b/composer.json index fbfde3f..7032f06 100644 --- a/composer.json +++ b/composer.json @@ -16,14 +16,15 @@ } ], "type": "symfony-bundle", + "minimum-stability": "dev", "prefer-stable": true, "require": { "php": ">=8.1", - "symfony/framework-bundle": "5.4.*", - "roadiz/core-bundle": "2.2.*", - "roadiz/rozier": "2.2.*", - "roadiz/compat-bundle": "2.2.*", - "roadiz/openid": "2.2.*" + "symfony/framework-bundle": "6.4.*", + "roadiz/core-bundle": "2.3.*", + "roadiz/rozier": "2.3.*", + "roadiz/compat-bundle": "2.3.*", + "roadiz/openid": "2.3.*" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4", @@ -54,8 +55,8 @@ }, "extra": { "branch-alias": { - "dev-main": "2.2.x-dev", - "dev-develop": "2.3.x-dev" + "dev-main": "2.3.x-dev", + "dev-develop": "2.4.x-dev" } } } diff --git a/config/packages/roadiz_rozier.yaml b/config/packages/roadiz_rozier.yaml index c2a07d1..ddf269e 100644 --- a/config/packages/roadiz_rozier.yaml +++ b/config/packages/roadiz_rozier.yaml @@ -18,6 +18,7 @@ roadiz_rozier: # OpenID identity provider OAuth2 client secret oauth_client_secret: '%env(string:OPEN_ID_CLIENT_SECRET)%' requires_local_user: false + force_ssl_on_redirect_uri: true # Only when local users are not required, creating virtual users # with following roles. granted_roles: diff --git a/config/routing.yaml b/config/routing.yaml index d4913ae..06afab8 100644 --- a/config/routing.yaml +++ b/config/routing.yaml @@ -214,10 +214,6 @@ webhooksRoutes: # CSS to style with main color # NOT SECURED ROUTES # -cssMainColor: - path : /css/main-color.css - controller: Themes\Rozier\RozierApp::cssAction - loginImagePage: path: /css/login/image controller: Themes\Rozier\Controllers\LoginController::imageAction diff --git a/config/services.yaml b/config/services.yaml index 822d65b..4dfebde 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -11,6 +11,9 @@ services: $addNodeFormTypeClass: '%roadiz_rozier.add_node_form.class%' $googleServerId: '%roadiz_core.medias.google_server_id%' $soundcloudClientId: '%roadiz_core.medias.soundcloud_client_id%' + $allowNodeTypeEdition: '%kernel.debug%' + $forceSslOnRedirectUri: '%roadiz_rozier.open_id.force_ssl_on_redirect_uri%' + $useGravatar: '%roadiz_core.use_gravatar%' RZ\Roadiz\RozierBundle\: resource: '../src/' diff --git a/phpstan.neon b/phpstan.neon index 7aea690..fed36a4 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 6 + level: 7 paths: - src doctrine: @@ -9,6 +9,8 @@ parameters: - */bower_components/* - */static/* ignoreErrors: + - identifier: missingType.iterableValue + - identifier: missingType.generics - '#Call to an undefined method RZ\\Roadiz\\CoreBundle\\Repository#' - '#Call to an undefined method RZ\\Roadiz\\UserBundle\\Repository#' - '#Call to an undefined method Doctrine\\Persistence\\ObjectRepository#' @@ -32,8 +34,6 @@ parameters: - '#does not accept Doctrine\\Common\\Collections\\ReadableCollection]+>#' reportUnmatchedIgnoredErrors: false - checkGenericClassInNonGenericObjectType: false - checkMissingIterableValueType: false includes: - vendor/phpstan/phpstan-doctrine/extension.neon - vendor/phpstan/phpstan-doctrine/rules.neon diff --git a/src/Aliases.php b/src/Aliases.php index b29be74..cc5621d 100644 --- a/src/Aliases.php +++ b/src/Aliases.php @@ -11,10 +11,6 @@ final class Aliases */ public static function getAliases(): array { - return [ - \RZ\Roadiz\RozierBundle\Form\DocumentTranslationType::class => \Themes\Rozier\Forms\DocumentTranslationType::class, - \RZ\Roadiz\RozierBundle\Form\CustomFormType::class => \Themes\Rozier\Forms\CustomFormType::class, - \RZ\Roadiz\RozierBundle\ListManager\SessionListFilters::class => \Themes\Rozier\Utils\SessionListFilters::class, - ]; + return []; } } diff --git a/src/Controller/Document/DocumentArchiveController.php b/src/Controller/Document/DocumentArchiveController.php index a7756bc..4c1f4b2 100644 --- a/src/Controller/Document/DocumentArchiveController.php +++ b/src/Controller/Document/DocumentArchiveController.php @@ -5,6 +5,7 @@ namespace RZ\Roadiz\RozierBundle\Controller\Document; use Doctrine\Persistence\ManagerRegistry; +use League\Flysystem\FilesystemException; use RZ\Roadiz\CoreBundle\Entity\Document; use RZ\Roadiz\Documents\DocumentArchiver; use Symfony\Component\Form\Extension\Core\Type\HiddenType; @@ -16,21 +17,15 @@ use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Contracts\Translation\TranslatorInterface; use Themes\Rozier\RozierApp; +use Twig\Error\RuntimeError; final class DocumentArchiveController extends RozierApp { - private ManagerRegistry $managerRegistry; - private TranslatorInterface $translator; - private DocumentArchiver $documentArchiver; - public function __construct( - ManagerRegistry $managerRegistry, - TranslatorInterface $translator, - DocumentArchiver $documentArchiver + private readonly ManagerRegistry $managerRegistry, + private readonly TranslatorInterface $translator, + private readonly DocumentArchiver $documentArchiver ) { - $this->managerRegistry = $managerRegistry; - $this->translator = $translator; - $this->documentArchiver = $documentArchiver; } /** @@ -39,6 +34,8 @@ public function __construct( * @param Request $request * * @return Response + * @throws FilesystemException + * @throws RuntimeError */ public function bulkDownloadAction(Request $request): Response { diff --git a/src/Controller/Document/DocumentDuplicatesController.php b/src/Controller/Document/DocumentDuplicatesController.php index 4adfd5c..21f3a63 100644 --- a/src/Controller/Document/DocumentDuplicatesController.php +++ b/src/Controller/Document/DocumentDuplicatesController.php @@ -7,22 +7,16 @@ use Doctrine\Persistence\ManagerRegistry; use RZ\Roadiz\CoreBundle\Entity\Document; use RZ\Roadiz\CoreBundle\ListManager\QueryBuilderListManager; +use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use RZ\Roadiz\CoreBundle\Repository\DocumentRepository; -use RZ\Roadiz\RozierBundle\ListManager\SessionListFilters; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Themes\Rozier\RozierApp; final class DocumentDuplicatesController extends RozierApp { - private ManagerRegistry $managerRegistry; - - /** - * @param ManagerRegistry $managerRegistry - */ - public function __construct(ManagerRegistry $managerRegistry) + public function __construct(private readonly ManagerRegistry $managerRegistry) { - $this->managerRegistry = $managerRegistry; } /** diff --git a/src/Controller/Document/DocumentLimitationsController.php b/src/Controller/Document/DocumentLimitationsController.php index cb2770e..cc83453 100644 --- a/src/Controller/Document/DocumentLimitationsController.php +++ b/src/Controller/Document/DocumentLimitationsController.php @@ -8,28 +8,20 @@ use RZ\Roadiz\CoreBundle\Entity\Document; use RZ\Roadiz\Documents\Events\DocumentUpdatedEvent; use RZ\Roadiz\RozierBundle\Form\DocumentLimitationsType; -use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Themes\Rozier\RozierApp; final class DocumentLimitationsController extends RozierApp { - private ManagerRegistry $managerRegistry; - - /** - * @param ManagerRegistry $managerRegistry - */ - public function __construct(ManagerRegistry $managerRegistry) + public function __construct(private readonly ManagerRegistry $managerRegistry) { - $this->managerRegistry = $managerRegistry; } public function limitationsAction(Request $request, Document $document): Response { $this->denyAccessUnlessGranted('ROLE_ACCESS_DOCUMENTS_LIMITATIONS'); - /** @var FormInterface $form */ $form = $this->createForm(DocumentLimitationsType::class, $document, [ 'referer' => $request->get('referer'), ]); diff --git a/src/Controller/Document/DocumentPublicListController.php b/src/Controller/Document/DocumentPublicListController.php index 6056966..15a1ab1 100644 --- a/src/Controller/Document/DocumentPublicListController.php +++ b/src/Controller/Document/DocumentPublicListController.php @@ -7,6 +7,7 @@ use RZ\Roadiz\CoreBundle\Entity\Document; use RZ\Roadiz\CoreBundle\Entity\Folder; use RZ\Roadiz\CoreBundle\Entity\Translation; +use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use RZ\Roadiz\Documents\Events\DocumentInFolderEvent; use RZ\Roadiz\Documents\Events\DocumentOutFolderEvent; use Symfony\Component\Form\ClickableInterface; @@ -19,7 +20,6 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Themes\Rozier\RozierApp; -use Themes\Rozier\Utils\SessionListFilters; use Twig\Error\RuntimeError; class DocumentPublicListController extends RozierApp diff --git a/src/Controller/Document/DocumentUnusedController.php b/src/Controller/Document/DocumentUnusedController.php index 945aedb..6958e5a 100644 --- a/src/Controller/Document/DocumentUnusedController.php +++ b/src/Controller/Document/DocumentUnusedController.php @@ -7,29 +7,25 @@ use Doctrine\Persistence\ManagerRegistry; use RZ\Roadiz\CoreBundle\Entity\Document; use RZ\Roadiz\CoreBundle\ListManager\QueryBuilderListManager; +use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use RZ\Roadiz\CoreBundle\Repository\DocumentRepository; -use RZ\Roadiz\RozierBundle\ListManager\SessionListFilters; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Themes\Rozier\RozierApp; +use Twig\Error\RuntimeError; final class DocumentUnusedController extends RozierApp { - private ManagerRegistry $managerRegistry; - - /** - * @param ManagerRegistry $managerRegistry - */ - public function __construct(ManagerRegistry $managerRegistry) + public function __construct(private readonly ManagerRegistry $managerRegistry) { - $this->managerRegistry = $managerRegistry; } /** * See unused documents. * - * @param Request $request + * @param Request $request * @return Response + * @throws RuntimeError */ public function unusedAction(Request $request): Response { diff --git a/src/Controller/Login/LoginRequestController.php b/src/Controller/Login/LoginRequestController.php index 81036e3..4fa16cb 100644 --- a/src/Controller/Login/LoginRequestController.php +++ b/src/Controller/Login/LoginRequestController.php @@ -4,6 +4,8 @@ namespace RZ\Roadiz\RozierBundle\Controller\Login; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; use Psr\Log\LoggerInterface; use RZ\Roadiz\CoreBundle\Form\LoginRequestForm; use RZ\Roadiz\CoreBundle\Security\User\UserViewer; @@ -12,20 +14,17 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Themes\Rozier\RozierApp; +use Twig\Error\RuntimeError; final class LoginRequestController extends RozierApp { use LoginRequestTrait; - private LoggerInterface $logger; - private UrlGeneratorInterface $urlGenerator; - private UserViewer $userViewer; - - public function __construct(LoggerInterface $logger, UrlGeneratorInterface $urlGenerator, UserViewer $userViewer) - { - $this->logger = $logger; - $this->urlGenerator = $urlGenerator; - $this->userViewer = $userViewer; + public function __construct( + private readonly LoggerInterface $logger, + private readonly UrlGeneratorInterface $urlGenerator, + private readonly UserViewer $userViewer + ) { } protected function getUserViewer(): UserViewer @@ -37,8 +36,9 @@ protected function getUserViewer(): UserViewer * @param Request $request * * @return Response - * @throws \Doctrine\ORM\ORMException - * @throws \Doctrine\ORM\OptimisticLockException + * @throws RuntimeError + * @throws ORMException + * @throws OptimisticLockException */ public function indexAction(Request $request): Response { @@ -70,6 +70,7 @@ public function indexAction(Request $request): Response /** * @return Response + * @throws RuntimeError */ public function confirmAction(): Response { diff --git a/src/Controller/Node/RealmNodeController.php b/src/Controller/Node/RealmNodeController.php index 43a278e..129d597 100644 --- a/src/Controller/Node/RealmNodeController.php +++ b/src/Controller/Node/RealmNodeController.php @@ -23,18 +23,11 @@ final class RealmNodeController extends RozierApp { - private ManagerRegistry $managerRegistry; - private TranslatorInterface $translator; - private EventDispatcherInterface $eventDispatcher; - public function __construct( - ManagerRegistry $managerRegistry, - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher + private readonly ManagerRegistry $managerRegistry, + private readonly TranslatorInterface $translator, + private readonly EventDispatcherInterface $eventDispatcher ) { - $this->managerRegistry = $managerRegistry; - $this->translator = $translator; - $this->eventDispatcher = $eventDispatcher; } public function defaultAction(Request $request, Node $id): Response @@ -65,9 +58,7 @@ public function defaultAction(Request $request, Node $id): Response 'node.%node%.joined.%realm%', [ '%node%' => $nodeSource->getTitle(), - '%realm%' => $realmNode->getRealm() ? - $realmNode->getRealm()->getName() : - $this->translator->trans('node.no_realm') + '%realm%' => $realmNode->getRealm()->getName() ] ); $this->publishConfirmMessage($request, $msg); @@ -118,9 +109,7 @@ public function deleteAction(Request $request, int $id, int $realmNodeId): Respo 'node.%node%.left.%realm%', [ '%node%' => $nodeSource->getTitle(), - '%realm%' => $realmNode->getRealm() ? - $realmNode->getRealm()->getName() : - $this->translator->trans('node.no_realm') + '%realm%' => $realmNode->getRealm()->getName() ] ); $this->publishConfirmMessage($request, $msg); diff --git a/src/Controller/Node/SeoController.php b/src/Controller/Node/SeoController.php index f5eaacb..fb2ee2f 100644 --- a/src/Controller/Node/SeoController.php +++ b/src/Controller/Node/SeoController.php @@ -31,14 +31,8 @@ final class SeoController extends RozierApp { - private FormFactoryInterface $formFactory; - - /** - * @param FormFactoryInterface $formFactory - */ - public function __construct(FormFactoryInterface $formFactory) + public function __construct(private readonly FormFactoryInterface $formFactory) { - $this->formFactory = $formFactory; } public function editAliasesAction( diff --git a/src/Controller/Node/TranslateController.php b/src/Controller/Node/TranslateController.php index 76142e0..0745ce1 100644 --- a/src/Controller/Node/TranslateController.php +++ b/src/Controller/Node/TranslateController.php @@ -18,14 +18,8 @@ final class TranslateController extends RozierApp { - private NodeTranslator $nodeTranslator; - - /** - * @param NodeTranslator $nodeTranslator - */ - public function __construct(NodeTranslator $nodeTranslator) + public function __construct(private readonly NodeTranslator $nodeTranslator) { - $this->nodeTranslator = $nodeTranslator; } public function translateAction(Request $request, Node $nodeId): Response diff --git a/src/Controller/PingController.php b/src/Controller/PingController.php index aa02775..b766f7f 100644 --- a/src/Controller/PingController.php +++ b/src/Controller/PingController.php @@ -11,20 +11,14 @@ final class PingController extends AbstractController { - private ?Profiler $profiler; - - public function __construct(?Profiler $profiler) + public function __construct(private readonly ?Profiler $profiler) { - $this->profiler = $profiler; } public function indexAction(): JsonResponse { // $profiler won't be set if your environment doesn't have the profiler (like prod, by default) - if (null !== $this->profiler) { - // if it exists, disable the profiler for this particular controller action - $this->profiler->disable(); - } + $this->profiler?->disable(); $this->denyAccessUnlessGranted('ROLE_BACKEND_USER'); diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 4809b28..e354ce2 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -11,28 +11,19 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Themes\Rozier\RozierServiceRegistry; class SecurityController extends AbstractController { - private OAuth2LinkGenerator $oAuth2LinkGenerator; - private LoggerInterface $logger; - private Settings $settingsBag; - private RozierServiceRegistry $rozierServiceRegistry; - public function __construct( - OAuth2LinkGenerator $oAuth2LinkGenerator, - LoggerInterface $logger, - Settings $settingsBag, - RozierServiceRegistry $rozierServiceRegistry + private readonly OAuth2LinkGenerator $oAuth2LinkGenerator, + private readonly LoggerInterface $logger, + private readonly Settings $settingsBag, + private readonly RozierServiceRegistry $rozierServiceRegistry ) { - $this->oAuth2LinkGenerator = $oAuth2LinkGenerator; - $this->logger = $logger; - $this->settingsBag = $settingsBag; - $this->rozierServiceRegistry = $rozierServiceRegistry; } #[Route(path: '/rz-admin/login', name: 'roadiz_rozier_login')] @@ -49,7 +40,11 @@ public function login(Request $request, AuthenticationUtils $authenticationUtils $assignation = [ 'last_username' => $lastUsername, 'error' => $error, - 'themeServices' => $this->rozierServiceRegistry + 'themeServices' => $this->rozierServiceRegistry, + 'head' => [ + 'siteTitle' => $this->settingsBag->get('site_name') . ' backstage', + 'mainColor' => $this->settingsBag->get('main_color'), + ] ]; try { diff --git a/src/DependencyInjection/Compiler/RozierPathsCompilerPass.php b/src/DependencyInjection/Compiler/RozierPathsCompilerPass.php index 99414d4..bd19d2c 100644 --- a/src/DependencyInjection/Compiler/RozierPathsCompilerPass.php +++ b/src/DependencyInjection/Compiler/RozierPathsCompilerPass.php @@ -4,9 +4,7 @@ namespace RZ\Roadiz\RozierBundle\DependencyInjection\Compiler; -use RZ\Roadiz\RozierBundle\DependencyInjection\Configuration; use Symfony\Component\Asset\PathPackage; -use Symfony\Component\Config\Definition\Processor; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 7a4d04f..7be2e57 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -76,6 +76,13 @@ protected function addOpenIdNode() ->defaultTrue() ->info(<<end() + ->booleanNode('force_ssl_on_redirect_uri') + ->defaultTrue() + ->info(<<end() diff --git a/src/DependencyInjection/RoadizRozierExtension.php b/src/DependencyInjection/RoadizRozierExtension.php index 3711486..ca22e1c 100644 --- a/src/DependencyInjection/RoadizRozierExtension.php +++ b/src/DependencyInjection/RoadizRozierExtension.php @@ -44,6 +44,7 @@ public function load(array $configs, ContainerBuilder $container): void private function registerOpenId(array $config, ContainerBuilder $container): void { $container->setParameter('roadiz_rozier.open_id.verify_user_info', $config['open_id']['verify_user_info']); + $container->setParameter('roadiz_rozier.open_id.force_ssl_on_redirect_uri', $config['open_id']['force_ssl_on_redirect_uri']); $container->setParameter('roadiz_rozier.open_id.discovery_url', $config['open_id']['discovery_url']); $container->setParameter('roadiz_rozier.open_id.hosted_domain', $config['open_id']['hosted_domain']); $container->setParameter('roadiz_rozier.open_id.oauth_client_id', $config['open_id']['oauth_client_id']); @@ -65,7 +66,9 @@ private function registerOpenId(array $config, ContainerBuilder $container): voi ->setPublic(true) ->setArguments([ $config['open_id']['discovery_url'], - new Reference(\Psr\Cache\CacheItemPoolInterface::class) + new Reference(\Psr\Cache\CacheItemPoolInterface::class), + new Reference(\Symfony\Contracts\HttpClient\HttpClientInterface::class), + new Reference(\Psr\Log\LoggerInterface::class) ]) ); } @@ -97,10 +100,12 @@ private function registerOpenId(array $config, ContainerBuilder $container): voi new Reference(\RZ\Roadiz\OpenId\Authentication\Provider\ChainJwtRoleStrategy::class), new Reference('roadiz_rozier.open_id.jwt_configuration_factory'), new Reference(\Symfony\Component\Routing\Generator\UrlGeneratorInterface::class), + new Reference(\Symfony\Contracts\HttpClient\HttpClientInterface::class), 'loginPage', 'adminHomePage', $config['open_id']['oauth_client_id'], $config['open_id']['oauth_client_secret'], + $config['open_id']['force_ssl_on_redirect_uri'], $config['open_id']['requires_local_user'], $config['open_id']['openid_username_claim'], '_target_path', diff --git a/src/Form/CustomFormType.php b/src/Form/CustomFormType.php deleted file mode 100644 index 7bad688..0000000 --- a/src/Form/CustomFormType.php +++ /dev/null @@ -1,121 +0,0 @@ -security = $security; - } - - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('displayName', TextType::class, [ - 'label' => 'customForm.displayName', - 'empty_data' => '', - ]) - ->add('description', MarkdownType::class, [ - 'label' => 'description', - 'required' => false, - ]) - ->add('email', TextType::class, [ - 'label' => 'email', - 'required' => false, - 'constraints' => [ - new Callback(function ($value, ExecutionContextInterface $context) { - $emails = array_filter( - array_map('trim', explode(',', $value ?? '')) - ); - foreach ($emails as $email) { - if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) { - $context->buildViolation('{{ value }} is not a valid email address.') - ->setParameter('{{ value }}', $email) - ->setCode(Email::INVALID_FORMAT_ERROR) - ->addViolation(); - } - } - }), - ], - ]) - ; - if ($this->security->isGranted('ROLE_ACCESS_CUSTOMFORMS_RETENTION')) { - $builder->add('retentionTime', ChoiceType::class, [ - 'label' => 'customForm.retentionTime', - 'help' => 'customForm.retentionTime.help', - 'required' => false, - 'placeholder' => 'customForm.retentionTime.always', - 'choices' => [ - 'customForm.retentionTime.one_week' => 'P7D', - 'customForm.retentionTime.two_weeks' => 'P14D', - 'customForm.retentionTime.one_month' => 'P1M', - 'customForm.retentionTime.three_months' => 'P3M', - 'customForm.retentionTime.six_months' => 'P6M', - 'customForm.retentionTime.one_year' => 'P1Y', - 'customForm.retentionTime.two_years' => 'P2Y', - ] - ]); - } - $builder->add('open', CheckboxType::class, [ - 'label' => 'customForm.open', - 'required' => false, - ]) - ->add('closeDate', DateTimeType::class, [ - 'label' => 'customForm.closeDate', - 'required' => false, - 'date_widget' => 'single_text', - 'date_format' => 'yyyy-MM-dd', - 'attr' => [ - 'class' => 'rz-datetime-field', - ], - 'placeholder' => [ - 'hour' => 'hour', - 'minute' => 'minute', - ], - ]) - ->add('color', ColorType::class, [ - 'label' => 'customForm.color', - 'required' => false, - ]); - } - - public function getBlockPrefix(): string - { - return 'customform'; - } - - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'label' => false, - 'name' => '', - 'data_class' => CustomForm::class, - 'attr' => [ - 'class' => 'uk-form custom-form-form', - ], - ]); - $resolver->setAllowedTypes('name', 'string'); - } -} diff --git a/src/Form/DocumentTranslationType.php b/src/Form/DocumentTranslationType.php deleted file mode 100644 index b8af849..0000000 --- a/src/Form/DocumentTranslationType.php +++ /dev/null @@ -1,53 +0,0 @@ -add('referer', HiddenType::class, [ - 'data' => $options['referer'], - 'mapped' => false, - ]) - ->add('name', TextType::class, [ - 'label' => 'name', - 'required' => false, - ]) - ->add('description', MarkdownType::class, [ - 'label' => 'description', - 'required' => false, - ]) - ->add('copyright', TextType::class, [ - 'label' => 'document.copyrightHolder', - 'required' => false, - ]) - ->add('externalUrl', TextType::class, [ - 'label' => 'document.externalUrl', - 'required' => false, - ]); - } - - /** - * @inheritDoc - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => DocumentTranslation::class - ]); - - $resolver->setRequired('referer'); - $resolver->setAllowedTypes('referer', ['null', 'string']); - } -} diff --git a/src/Form/NodesTagsType.php b/src/Form/NodesTagsType.php index b4aa2ef..cec311c 100644 --- a/src/Form/NodesTagsType.php +++ b/src/Form/NodesTagsType.php @@ -14,14 +14,8 @@ final class NodesTagsType extends AbstractType { - protected ManagerRegistry $managerRegistry; - - /** - * @param ManagerRegistry $managerRegistry - */ - public function __construct(ManagerRegistry $managerRegistry) + public function __construct(private readonly ManagerRegistry $managerRegistry) { - $this->managerRegistry = $managerRegistry; } /** diff --git a/src/ListManager/SessionListFilters.php b/src/ListManager/SessionListFilters.php deleted file mode 100644 index 752b1c0..0000000 --- a/src/ListManager/SessionListFilters.php +++ /dev/null @@ -1,61 +0,0 @@ -sessionIdentifier = $sessionIdentifier; - $this->defaultItemsParPage = $defaultItemsParPage; - } - - /** - * Handle item_per_page filter form session or from request query. - * - * @param Request $request - * @param EntityListManagerInterface $listManager - */ - public function handleItemPerPage(Request $request, EntityListManagerInterface $listManager): void - { - /* - * Check if item_per_page is available from session - */ - if ( - $request->hasSession() && - $request->getSession()->has($this->sessionIdentifier) && - $request->getSession()->get($this->sessionIdentifier) > 0 && - (!$request->query->has('item_per_page') || - $request->query->get('item_per_page') < 1) - ) { - /* - * Item count is in session - */ - $request->query->set('item_per_page', intval($request->getSession()->get($this->sessionIdentifier))); - $listManager->setItemPerPage(intval($request->getSession()->get($this->sessionIdentifier))); - } elseif ( - $request->query->has('item_per_page') && - $request->query->get('item_per_page') > 0 - ) { - /* - * Item count is in query, save it in session - */ - $request->getSession()->set($this->sessionIdentifier, intval($request->query->get('item_per_page'))); - $listManager->setItemPerPage(intval($request->query->get('item_per_page'))); - } else { - $listManager->setItemPerPage($this->defaultItemsParPage); - } - } -} diff --git a/templates/custom-forms/usage.html.twig b/templates/custom-forms/usage.html.twig index 80e4576..9481a99 100644 --- a/templates/custom-forms/usage.html.twig +++ b/templates/custom-forms/usage.html.twig @@ -22,13 +22,12 @@ {% trans %}title{% endtrans %} {% trans %}usage.fieldName{% endtrans %} - {% trans %}nodeType.name{% endtrans %} {% for usage in usages %} {% set source = usage.node.nodeSources.first %} - {% set field = usage.field %} + {% set field = usage.fieldName %} {% trans %}duplicate{% endtrans %} {% endif %} - {% if is_granted('EDIT_ATTRIBUTE', node) %} + {% if is_granted('EDIT_SETTING', node) %} - {% block title %}{% trans %}back_office{% endtrans %}{% endblock %} + {% block title %}{% trans %}back_office{% endtrans %}: {{ head.siteTitle|default(meta.siteName) }}{% endblock %} {% include '@RoadizRozier/admin/meta-icon.html.twig' %} {# CSS scripts inclusions / Using webpack #} {% include '@RoadizRozier/partials/css-inject.html.twig' %} - + {% if head.mainColor %} + + {% endif %} {% include '@RoadizRozier/includes/messages.html.twig' %}
-
{% block content %} diff --git a/translations/custom-forms/messages.en.xlf b/translations/custom-forms/messages.en.xlf index 57a07a8..4b25760 100644 --- a/translations/custom-forms/messages.en.xlf +++ b/translations/custom-forms/messages.en.xlf @@ -57,6 +57,146 @@ 2 year + + customForm.autocomplete + Auto-complete hint + + + + customForm.autocomplete.help + Provides a specific hint to browsers and input helpers on the value to auto-complete for this field. + + + + autocomplete.no_autocomplete + -- Undefined -- + + + + autocomplete.off + Do not auto-complete this field + + + + autocomplete.name + Full name + + + + autocomplete.honorific-prefix + Prefix or title, such as "Mrs.", "Mr.", "Miss", "Ms.", "Dr.", etc + + + + autocomplete.honorific-suffix + Suffix, such as "Jr.", "B.Sc.", "PhD.", "MBASW", or "IV" + + + + autocomplete.given-name + Given (or "first") name + + + + autocomplete.additional-name + Middle name + + + + autocomplete.family-name + Family (or "last") name + + + + autocomplete.nickname + Nickname or handle + + + + autocomplete.email + Email address + + + + autocomplete.username + Username or account name + + + + autocomplete.organization-title + Job title + + + + autocomplete.organization + Company or organization name + + + + autocomplete.street-address + Street address + + + + autocomplete.country + Country or territory code + + + + autocomplete.country-name + Country or territory name + + + + autocomplete.postal-code + Postal (or ZIP) code + + + + autocomplete.bday + Birth date, as a full date + + + + autocomplete.bday-day + Day of the month of a birth date + + + + autocomplete.bday-month + Month of the year of a birth date + + + + autocomplete.bday-year + Year of a birth date + + + + autocomplete.sex + Gender identity + + + + autocomplete.tel + Full phone number, including the country code + + + + autocomplete.tel-national + Phone number without the country code component + + + + autocomplete.url + A URL, as appropriate given the context of the form + + + + autocomplete.photo + URL of an image representing the contact information given in the form. + + diff --git a/translations/custom-forms/messages.fr.xlf b/translations/custom-forms/messages.fr.xlf index 482df27..536eab2 100644 --- a/translations/custom-forms/messages.fr.xlf +++ b/translations/custom-forms/messages.fr.xlf @@ -57,6 +57,146 @@ 2 ans + + customForm.autocomplete + Aide à l'auto-complétion + + + + customForm.autocomplete.help + Fournit un indice spécifique aux navigateurs et aides à la saisie sur la valeur à auto-completer pour ce champ. + + + + autocomplete.no_autocomplete + -- Non défini -- + + + + autocomplete.off + Désactiver l'auto-complétion pour ce champ + + + + autocomplete.name + Nom complet + + + + autocomplete.honorific-prefix + Préfixe ou titre, par exemple « M. », « Mme. », « Me. » , etc + + + + autocomplete.honorific-suffix + Suffixe (par exemple "Jr.") + + + + autocomplete.given-name + Prénom + + + + autocomplete.additional-name + Deuxième prénom + + + + autocomplete.family-name + Nom de famille + + + + autocomplete.nickname + Surnom + + + + autocomplete.email + Adresse email + + + + autocomplete.username + Nom de compte ou un nom d'utilisateur + + + + autocomplete.organization-title + Titre de poste professionnel + + + + autocomplete.organization + Nom d'une entreprise ou d'une organisation + + + + autocomplete.street-address + Adresse postale + + + + autocomplete.country + Code de pays + + + + autocomplete.country-name + Nom de pays + + + + autocomplete.postal-code + Code postal + + + + autocomplete.bday + Date de naissance complète + + + + autocomplete.bday-day + Jour de naissance + + + + autocomplete.bday-month + Mois de naissance + + + + autocomplete.bday-year + Année de naissance + + + + autocomplete.sex + Genre + + + + autocomplete.tel + Téléphone (avec indicateur du pays) + + + + autocomplete.tel-national + Téléphone (sans indicateur du pays) + + + + autocomplete.url + Une URL, pertinente dans le contexte du formulaire + + + + autocomplete.photo + URL d'une image représentant l'information de contact + + diff --git a/translations/custom-forms/messages.xlf b/translations/custom-forms/messages.xlf index b9e9383..b646657 100644 --- a/translations/custom-forms/messages.xlf +++ b/translations/custom-forms/messages.xlf @@ -57,6 +57,146 @@ + + customForm.autocomplete + + + + + customForm.autocomplete.help + + + + + autocomplete.no_autocomplete + + + + + autocomplete.off + + + + + autocomplete.name + + + + + autocomplete.honorific-prefix + + + + + autocomplete.honorific-suffix + + + + + autocomplete.given-name + + + + + autocomplete.additional-name + + + + + autocomplete.family-name + + + + + autocomplete.nickname + + + + + autocomplete.email + + + + + autocomplete.username + + + + + autocomplete.organization-title + + + + + autocomplete.organization + + + + + autocomplete.street-address + + + + + autocomplete.country + + + + + autocomplete.country-name + + + + + autocomplete.postal-code + + + + + autocomplete.bday + + + + + autocomplete.bday-day + + + + + autocomplete.bday-month + + + + + autocomplete.bday-year + + + + + autocomplete.sex + + + + + autocomplete.tel + + + + + autocomplete.tel-national + + + + + autocomplete.url + + + + + autocomplete.photo + + + diff --git a/translations/helps/messages.ar.xlf b/translations/helps/messages.ar.xlf index eda2691..75f6fcb 100644 --- a/translations/helps/messages.ar.xlf +++ b/translations/helps/messages.ar.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.de.xlf b/translations/helps/messages.de.xlf index bfd8e2c..00c224f 100644 --- a/translations/helps/messages.de.xlf +++ b/translations/helps/messages.de.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.en.xlf b/translations/helps/messages.en.xlf index 9db6536..8cb18b3 100644 --- a/translations/helps/messages.en.xlf +++ b/translations/helps/messages.en.xlf @@ -23,9 +23,6 @@ nodeSource.metaTitle.help SEO title allows you to write the entire title of your page. For optimal display in search engines, the title should not exceed 55 to 65 characters on average. - - nodeSource.metaKeywords.help - SEO keywords are now optional and are no longer taken into account by search engines. nodeSource.metaDescription.help SEO description is a summary in a few characters of your page. Its purpose is to briefly describe its content. This description must be between 120 and 155 characters long. diff --git a/translations/helps/messages.es.xlf b/translations/helps/messages.es.xlf index 6bf68b4..4e8f1c8 100644 --- a/translations/helps/messages.es.xlf +++ b/translations/helps/messages.es.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.fr.xlf b/translations/helps/messages.fr.xlf index 976e0bc..6b097ef 100644 --- a/translations/helps/messages.fr.xlf +++ b/translations/helps/messages.fr.xlf @@ -23,9 +23,6 @@ nodeSource.metaTitle.help Le titre de référencement permet de rédiger entièrement le titre de votre page. Pour un affichage optimal dans les moteurs de recherche, le titre ne doit pas dépasser 55 à 65 caractères en moyenne. - - nodeSource.metaKeywords.help - Les mot-clés de référencement sont aujourd’hui facultatifs et ne sont plus pris en compte par les moteurs de recherche. nodeSource.metaDescription.help La description est un résumé de quelques caractères de votre page. Son objectif est de décrire succinctement son contenu. Cette description doit respecter une taille entre 120 et 155 caractères. diff --git a/translations/helps/messages.id.xlf b/translations/helps/messages.id.xlf index f9d6ef0..0a767aa 100644 --- a/translations/helps/messages.id.xlf +++ b/translations/helps/messages.id.xlf @@ -20,9 +20,6 @@ nodeSource.metaTitle.help Judul SEO memungkinkan Anda untuk menulis seluruh judul halaman Anda. Untuk tampilan optimal di mesin pencari, judulnya tidak boleh melebihi 55 hingga 65 karakter rata-rata. - - nodeSource.metaKeywords.help - Kata kunci SEO sekarang opsional dan tidak lagi diperhitungkan oleh mesin pencari. nodeSource.metaDescription.help Deskripsi SEO adalah ringkasan dalam beberapa karakter halaman Anda. Tujuannya adalah untuk menggambarkan kontennya secara singkat. Deskripsi ini harus antara 120 dan 155 karakter. diff --git a/translations/helps/messages.it.xlf b/translations/helps/messages.it.xlf index 3e14d9f..363c1f0 100644 --- a/translations/helps/messages.it.xlf +++ b/translations/helps/messages.it.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.ru.xlf b/translations/helps/messages.ru.xlf index 9035dde..f25ae24 100644 --- a/translations/helps/messages.ru.xlf +++ b/translations/helps/messages.ru.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.sr.xlf b/translations/helps/messages.sr.xlf index 8805118..3b94aaf 100644 --- a/translations/helps/messages.sr.xlf +++ b/translations/helps/messages.sr.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.tr.xlf b/translations/helps/messages.tr.xlf index 3d78c60..19e77f7 100644 --- a/translations/helps/messages.tr.xlf +++ b/translations/helps/messages.tr.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.uk.xlf b/translations/helps/messages.uk.xlf index c686e09..da76b03 100644 --- a/translations/helps/messages.uk.xlf +++ b/translations/helps/messages.uk.xlf @@ -19,7 +19,6 @@ - diff --git a/translations/helps/messages.xlf b/translations/helps/messages.xlf index d1de0b2..36f2e97 100644 --- a/translations/helps/messages.xlf +++ b/translations/helps/messages.xlf @@ -23,9 +23,6 @@ nodeSource.metaTitle.help - - nodeSource.metaKeywords.help - nodeSource.metaDescription.help diff --git a/translations/helps/messages.zh.xlf b/translations/helps/messages.zh.xlf index ad9d67b..7427ff1 100644 --- a/translations/helps/messages.zh.xlf +++ b/translations/helps/messages.zh.xlf @@ -20,9 +20,6 @@ nodeSource.metaTitle.help SEO 标题能让您写下您页面的全部标题。为了在搜索引擎中完全显示,标题一般不应该超过 55 到 65 个字。 - - nodeSource.metaKeywords.help - SEO 关键词现在是可选的,且不再被搜索引擎重视。 nodeSource.metaDescription.help SEO 描述是您页面的几个字的总结。它的目的是为了简略的描述它的内容。此描述的长度必须介于 120 到 155 个字之间。