我使用并需要为 V10 更新的代码
$this->feUser = EidUtility::initFeUser();
当使用以下代码(随机) Controller 时,上下文为我提供了正确的登录 feUser 对象。
$context = GeneralUtility::makeInstance(Context::class);
$user = $context->getAspect('frontend.user');
DebuggerUtility::var_dump($user);
在 eID_include
类中使用相同的代码时 No userObject 被给出。
具体在下课
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess']['xxx'] = My\Class\Hooks\FileDumpHook:class
是否需要引导上下文?
最佳答案
由于 TYPO3\CMS\Frontend\Middleware\EidHandler 中间件在中间件顺序中的 TYPO3\CMS\Frontend\Middleware\FrontendUserAuthenticator 中间件之前执行,我认为这是不可能的。
如果您需要前端处理的一部分,您可以添加一个自己的中间件,依赖于 TYPO3\CMS\Frontend\Middleware\FrontendUserAuthenticator 或在 typescript 中使用页面对象。
关于php - TYPO3 v10 - 在 eID_include 中使用上下文 API 获取 feUser 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61637105/