Actions
Bug #96137
closedAspect of frontend.user wont't work after Middleware 'typo3/cms-frontend/authentication'
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2021-11-29
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
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]
Actions