src/AppBundle/Listener/PermissionKernelResponseListener.php line 18

Open in your IDE?
  1. <?php
  2. namespace AppBundle\Listener;
  3. use Symfony\Component\HttpKernel\Event\ResponseEvent;
  4. use Symfony\Component\HttpKernel\HttpKernelInterface;
  5. use Topxia\Service\Common\ServiceKernel;
  6. class PermissionKernelResponseListener
  7. {
  8.     private $container;
  9.     public function __construct($container)
  10.     {
  11.         $this->container $container;
  12.     }
  13.     public function onKernelResponse(ResponseEvent $event)
  14.     {
  15.         if (HttpKernelInterface::MAIN_REQUEST != $event->getRequestType()) {
  16.             return;
  17.         }
  18.         ServiceKernel::instance()->getCurrentUser()->setPermissions(null);
  19.     }
  20. }