-
Couldn't load subscription status.
- Fork 2
IBX-10170: Introduced AccessCheckController contract #111
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
Changes from 1 commit
293d4b0
51b55b0
cf2acf3
0daae07
10124be
2ba7b59
0e801fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
| * @license For full copyright and license information view LICENSE file distributed with this source code. | ||
| */ | ||
| declare(strict_types=1); | ||
|
|
||
| namespace Ibexa\Contracts\User\Controller; | ||
|
|
||
| interface AccessCheckController | ||
| { | ||
| public function performAccessCheck(): void; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
| * @license For full copyright and license information view LICENSE file distributed with this source code. | ||
| */ | ||
| declare(strict_types=1); | ||
|
|
||
| namespace Ibexa\Contracts\User\Controller; | ||
|
|
||
| trait AuthenticatedRememberedCheckTrait | ||
| { | ||
| public function performAccessCheck(): void | ||
| { | ||
| $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
| * @license For full copyright and license information view LICENSE file distributed with this source code. | ||
| */ | ||
| declare(strict_types=1); | ||
|
|
||
| namespace Ibexa\User\EventListener; | ||
|
|
||
| use Ibexa\Contracts\User\Controller\AccessCheckController; | ||
| use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
| use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent; | ||
|
|
||
| final class PerformAccessCheckSubscriber implements EventSubscriberInterface | ||
| { | ||
| public function onControllerArgumentsEvent(ControllerArgumentsEvent $event): void | ||
| { | ||
| $controller = $event->getController(); | ||
| if (is_array($controller) && $controller[0] instanceof AccessCheckController) { | ||
|
||
| $controller[0]->performAccessCheck(); | ||
| } | ||
| } | ||
|
|
||
| public static function getSubscribedEvents(): array | ||
| { | ||
| return [ | ||
| ControllerArgumentsEvent::class => 'onControllerArgumentsEvent', | ||
|
||
| ]; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.