* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShopBundle\Controller\Admin\Configure\AdvancedParameters\AuthorizationServer; use PrestaShop\PrestaShop\Core\Search\Filters\AuthorizedApplicationsFilters; use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController; use PrestaShopBundle\Exception\NotImplementedException; use PrestaShopBundle\Security\Annotation\AdminSecurity; use Symfony\Component\HttpFoundation\Response; /** * Manages the "Configure > Advanced Parameters > Authorization Server" page. * * @experimental */ class ApplicationController extends FrameworkBundleAdminController { /** * @AdminSecurity("is_granted('create', request.get('_legacy_controller')) || is_granted('update', request.get('_legacy_controller')) || is_granted('delete', request.get('_legacy_controller')) || is_granted('read', request.get('_legacy_controller'))") * * @param AuthorizedApplicationsFilters $filters the list of filters from the request * * @return Response */ public function indexAction(AuthorizedApplicationsFilters $filters): Response { $gridAuthorizedApplicationFactory = $this->get('prestashop.core.grid.factory.authorized_application'); $grid = $gridAuthorizedApplicationFactory->getGrid($filters); return $this->render('@PrestaShop/Admin/Configure/AdvancedParameters/AuthorizationServer/index.html.twig', [ 'help_link' => $this->generateSidebarLink('AdminAuthorizationServer'), 'layoutTitle' => $this->trans('Authorization Server Management', 'Admin.Navigation.Menu'), 'requireBulkActions' => false, 'showContentHeader' => true, 'enableSidebar' => true, 'layoutHeaderToolbarBtn' => $this->getApplicationToolbarButtons(), 'grid' => $this->presentGrid($grid), ]); } /** * @AdminSecurity("is_granted('create', request.get('_legacy_controller')) || is_granted('update', request.get('_legacy_controller')) || is_granted('delete', request.get('_legacy_controller')) || is_granted('read', request.get('_legacy_controller'))") */ public function viewAction(): void { // TODO: Implement viewAction() method in view PR. throw new NotImplementedException(); } /** * @AdminSecurity("is_granted('create', request.get('_legacy_controller'))") */ public function createAction(): void { // TODO: Implement createAction() method in create PR. throw new NotImplementedException(); } /** * @AdminSecurity("is_granted('update', request.get('_legacy_controller'))") */ public function editAction(): void { // TODO: Implement editAction() method in edit PR. throw new NotImplementedException(); } /** * @AdminSecurity("is_granted('delete', request.get('_legacy_controller'))") */ public function deleteAction(): void { // TODO: Implement deleteAction() method in delete PR. throw new NotImplementedException(); } /** * @return array */ private function getApplicationToolbarButtons(): array { $toolbarButtons = []; $toolbarButtons['addApplication'] = [ 'href' => $this->generateUrl('admin_authorized_applications_create'), 'desc' => $this->trans('Add new authorized app', 'Admin.Actions'), 'icon' => 'add_circle_outline', 'class' => 'btn-primary', ]; $toolbarButtons['addApiAccess'] = [ 'href' => $this->generateUrl('admin_api_accesses_create'), 'desc' => $this->trans('Add new API access', 'Admin.Actions'), 'icon' => 'add_circle_outline', 'class' => 'btn-primary', ]; return $toolbarButtons; } }