PHP Class Bolt\EventListener\RedirectListener

Author: Carson Full ([email protected])
Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
Show file Open project: bolt/bolt

Protected Properties

Property Type Description
$authentication Bolt\AccessControl\AccessChecker
$session Symfony\Component\HttpFoundation\Session\Session
$urlGenerator Symfony\Component\Routing\Generator\UrlGeneratorInterface
$users Bolt\Users

Public Methods

Method Description
__construct ( Symfony\Component\HttpFoundation\Session\Session $session, Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator, Users $users, AccessChecker $authentication ) RedirectListener constructor.
getSubscribedEvents ( ) : array Return the events to subscribe to.
onResponse ( FilterResponseEvent $event ) Kernel response listener callback.

Protected Methods

Method Description
handleLoginRetreat ( Request $request, RedirectResponse $response ) When redirecting to login page set the 'retreat' variable in the session.
handleNoBackendAccess ( RedirectResponse $response ) When redirecting to the backend dashboard (while logged in), if the user does not have access change the redirect to the homepage.

Method Details

__construct() public method

RedirectListener constructor.
public __construct ( Symfony\Component\HttpFoundation\Session\Session $session, Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator, Users $users, AccessChecker $authentication )
$session Symfony\Component\HttpFoundation\Session\Session
$urlGenerator Symfony\Component\Routing\Generator\UrlGeneratorInterface
$users Bolt\Users
$authentication Bolt\AccessControl\AccessChecker

getSubscribedEvents() public static method

Return the events to subscribe to.
public static getSubscribedEvents ( ) : array
return array

handleLoginRetreat() protected method

This allows a redirect back to the current page after successful login.
protected handleLoginRetreat ( Request $request, RedirectResponse $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\RedirectResponse

handleNoBackendAccess() protected method

When redirecting to the backend dashboard (while logged in), if the user does not have access change the redirect to the homepage.
protected handleNoBackendAccess ( RedirectResponse $response )
$response Symfony\Component\HttpFoundation\RedirectResponse

onResponse() public method

Kernel response listener callback.
public onResponse ( FilterResponseEvent $event )
$event Symfony\Component\HttpKernel\Event\FilterResponseEvent

Property Details

$authentication protected property

protected AccessChecker,Bolt\AccessControl $authentication
return Bolt\AccessControl\AccessChecker

$session protected property

protected Session,Symfony\Component\HttpFoundation\Session $session
return Symfony\Component\HttpFoundation\Session\Session

$urlGenerator protected property

protected UrlGeneratorInterface,Symfony\Component\Routing\Generator $urlGenerator
return Symfony\Component\Routing\Generator\UrlGeneratorInterface

$users protected property

protected Users,Bolt $users
return Bolt\Users