*/ class tao_actions_Security extends tao_actions_CommonModule { /** @var SecuritySettingsRepositoryInterface */ private $repository; /** * @inheritDoc */ public function initialize(): void { parent::initialize(); $this->repository = $this->getServiceLocator()->get(SecuritySettingsRepositoryInterface::class); } public function index(): void { $this->setView('security/view.tpl'); $formFactory = new tao_actions_form_CspHeader( [tao_actions_form_CspHeader::SETTINGS_DATA => $this->repository->findAll()], [FormContainer::CSRF_PROTECTION_OPTION => true] ); $cspHeaderForm = $formFactory->getForm(); if ($cspHeaderForm->isSubmited() && $cspHeaderForm->isValid()) { $this->repository->persist( $formFactory->getSettings() ); $this->setData('cspHeaderFormSuccess', __('CSP Header settings were saved successfully!')); } $this->setData('cspHeaderForm', $cspHeaderForm->render()); } }