src/Resource/EventListener/SymfonyGrantedActionListener.php
public function onBeforeNormalization(BeforeNormalizationEvent $event): void
    {
        $resource = $event->getResource();

        if (!$resource instanceof ActionedResourceInterface) {
            return;
        }

        $actions = $resource->getActions();

        foreach ($actions as $action) {
            if (!$action instanceof SymfonyGrantedAction) {
                continue;
            }

            if (!$this->authorizationChecker->isGranted($action->getAttribute(), $action->getObject())) {
                $resource->removeAction($action);
            }
        }
    }
public function onBeforeNormalization(BeforeNormalizationEvent $event): void
    {
        $resource = $event->getResource();

        if (!$resource instanceof ActionedResourceInterface) {
            return;
        }

        $actions = $resource->getActions();

        foreach ($actions as $action) {
            if (!$action instanceof SymfonyGrantedAction) {
                continue;
            }

            if (!$this->authorizationChecker->isGranted($action->getAttribute(), $action->getObject())) {
                $resource->removeAction($action);
            }
        }
    }
public function onBeforeNormalization ( BeforeNormalizationEvent $ event ) : void { $ resource = $ event -> getResource ( ) ; if ( ! $ resource instanceof ActionedResourceInterface ) { return ; } $ actions = $ resource -> getActions ( ) ; foreach ( $ actions as $ action ) { if ( ! $ action instanceof SymfonyGrantedAction ) { continue ; } if ( ! $ this -> authorizationChecker -> isGranted ( $ action -> getAttribute ( ) , $ action -> getObject ( ) ) ) { $ resource -> removeAction ( $ action ) ; } } }
Check the grants to actions

@param BeforeNormalizationEvent $event
Check the grants to actions