#96137Aspect of frontend.user wont't work after Middleware 'typo3/cms-frontend/authentication'
Description
I registered an own middleware with.
return [
'frontend' => [
'me/ext/fileload-for-user' => [
'target' => \Me\Ext\Middleware\FileloadForFeUser::class,
'before' => [
'typo3/cms-frontend/static-route-resolver'
],
'after' => [
'typo3/cms-frontend/authentication'
]
],
],
];
I could get the Id of my login-user but not its usergroups. I needed the workaround. I could not get the aspects.
$context = GeneralUtility::makeInstance(Context::class);
// Checking if a user is logged in
$userUid = $context->getPropertyFromAspect('frontend.user', 'id');
$userGroupsRaw =$genericRepository->findFieldLikeUsergroupInFeUsersByUid($userUid); // Simple request with QueryBuilder on fe_users
if (is_string($userGroupsRaw)) {
$userGroups = (($userUid !== false) ?
array_merge(
[0,-2],
array_map(
'intval',
explode(',', $userGroupsRaw)
)
) :
(false)
);
} else {
$userGroups = false;
}
// $userGroupsRaw = $context->getPropertyFromAspect('frontend.user', 'groupIds'); // this wont work i only got [0,-2]Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.