vendor/sulu/sulu/src/Sulu/Bundle/SecurityBundle/Controller/ContextsController.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\SecurityBundle\Controller;
  11. use FOS\RestBundle\View\ViewHandlerInterface;
  12. use HandcraftedInTheAlps\RestRoutingBundle\Controller\Annotations\RouteResource;
  13. use HandcraftedInTheAlps\RestRoutingBundle\Routing\ClassResourceInterface;
  14. use Sulu\Bundle\AdminBundle\Admin\AdminPool;
  15. use Sulu\Bundle\AdminBundle\Controller\AdminController;
  16. use Sulu\Component\Rest\AbstractRestController;
  17. use Symfony\Component\HttpFoundation\Request;
  18. @\trigger_error(
  19.     \sprintf(
  20.         'The "%s" class is deprecated since Sulu 2.2, use data from "%s" instead.',
  21.         ContextsController::class,
  22.         AdminController::class
  23.     ),
  24.     \E_USER_DEPRECATED
  25. );
  26. /**
  27.  * @deprecated Deprecated since Sulu 2.2, use data from Sulu\Bundle\AdminBundle\Controller\AdminController::configAction
  28.  * @RouteResource("security-contexts")
  29.  */
  30. class ContextsController extends AbstractRestController implements ClassResourceInterface
  31. {
  32.     /**
  33.      * @var AdminPool
  34.      */
  35.     private $adminPool;
  36.     public function __construct(
  37.         ViewHandlerInterface $viewHandler,
  38.         AdminPool $adminPool
  39.     ) {
  40.         parent::__construct($viewHandler);
  41.         $this->adminPool $adminPool;
  42.     }
  43.     public function cgetAction(Request $request)
  44.     {
  45.         $securityContexts $this->adminPool->getSecurityContextsWithPlaceholder();
  46.         $view $this->view($securityContexts);
  47.         return $this->handleView($view);
  48.     }
  49. }