Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix access rights to Administration page #12096

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -29,10 +29,10 @@
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
use PrestaShopBundle\Security\Annotation\AdminSecurity;
use PrestaShopBundle\Security\Annotation\DemoRestricted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
* Responsible of "Configure > Advanced Parameters > Administration" page display.
Expand All @@ -44,8 +44,7 @@ class AdministrationController extends FrameworkBundleAdminController
/**
* Show Administration page.
*
* @Template("@PrestaShop/Admin/Configure/AdvancedParameters/administration.html.twig")
* @AdminSecurity("is_granted('read', request.get('_legacy_controller'))", message="Access denied.")
* @AdminSecurity("is_granted(['read', 'update', 'create', 'delete'], request.get('_legacy_controller'))", message="Access denied.")
*
* @param FormInterface $form
*
Expand All @@ -55,7 +54,7 @@ public function indexAction(FormInterface $form = null)
{
$form = is_null($form) ? $this->get('prestashop.adapter.administration.form_handler')->getForm() : $form;

return [
return $this->render('@PrestaShop/Admin/Configure/AdvancedParameters/administration.html.twig', [
'layoutHeaderToolbarBtn' => [],
'layoutTitle' => $this->trans('Administration', 'Admin.Navigation.Menu'),
'requireAddonsSearch' => true,
Expand All @@ -65,13 +64,13 @@ public function indexAction(FormInterface $form = null)
'help_link' => $this->generateSidebarLink('AdminAdminPreferences'),
'requireFilterStatus' => false,
'form' => $form->createView(),
];
]);
}

/**
* Process the Administration configuration form.
*
* @AdminSecurity("is_granted(['read', 'update', 'create', 'delete'], request.get('_legacy_controller'))", message="You do not have permission to update this.", redirectRoute="admin_administration")
* @AdminSecurity("is_granted(['update', 'create', 'delete'], request.get('_legacy_controller'))", message="You do not have permission to update this.", redirectRoute="admin_administration")
* @DemoRestricted(redirectRoute="admin_administration")
*
* @param Request $request
Expand Down