public function onKernelBuilt(PostBuildKernelEvent $event)
    {
        // Ignore if not in web context, if legacy_mode is active or if user is not authenticated
        if (
            $this->enabled === false
            || !$event->getKernelHandler() instanceof ezpWebBasedKernelHandler
            || $this->configResolver->getParameter('legacy_mode') === true
            || !$this->isUserAuthenticated()
        ) {
            return;
        }

        $currentUser = $this->repository->getCurrentUser();
        $event->getLegacyKernel()->runCallback(
            static function () use ($currentUser) {
                $legacyUser = eZUser::fetch($currentUser->id);
                eZUser::setCurrentlyLoggedInUser($legacyUser, $legacyUser->attribute('contentobject_id'), eZUser::NO_SESSION_REGENERATE);
            },
            false,
            false
        );
    }
public function onKernelBuilt(PostBuildKernelEvent $event)
    {
        // Ignore if not in web context, if legacy_mode is active or if user is not authenticated
        if (
            $this->enabled === false
            || !$event->getKernelHandler() instanceof ezpWebBasedKernelHandler
            || $this->configResolver->getParameter('legacy_mode') === true
            || !$this->isUserAuthenticated()
        ) {
            return;
        }

        $currentUser = $this->repository->getCurrentUser();
        $event->getLegacyKernel()->runCallback(
            static function () use ($currentUser) {
                $legacyUser = eZUser::fetch($currentUser->id);
                eZUser::setCurrentlyLoggedInUser($legacyUser, $legacyUser->attribute('contentobject_id'), eZUser::NO_SESSION_REGENERATE);
            },
            false,
            false
        );
    }
public function onKernelBuilt ( PostBuildKernelEvent $ event ) { // Ignore if not in web context, if legacy_mode is active or if user is not authenticated if ( $ this -> enabled === false || ! $ event -> getKernelHandler ( ) instanceof ezpWebBasedKernelHandler || $ this -> configResolver -> getParameter ( 'legacy_mode' ) === true || ! $ this -> isUserAuthenticated ( ) ) { return ; } $ currentUser = $ this -> repository -> getCurrentUser ( ) ; $ event -> getLegacyKernel ( ) -> runCallback ( static function ( ) use ( $ currentUser ) { $ legacyUser = eZUser :: fetch ( $ currentUser -> id ) ; eZUser :: setCurrentlyLoggedInUser ( $ legacyUser , $ legacyUser -> attribute ( 'contentobject_id' ) , eZUser :: NO_SESSION_REGENERATE ) ; } , false , false ) ; }
Performs actions related to security once the legacy kernel has been built.

@param PostBuildKernelEvent $event
Performs actions related to security once the legacy kernel has been built .