Feature #60751
closed
FrontendUser: Add method to get group-memberships recursive
Added by Stefan Neufeind over 10 years ago.
Updated about 9 years ago.
Description
Method getUsergroup() gets the Usergroup-property (0..n groups). Subgroups of those are not resolved. You'll have to do a getSubgroup() on each of them recursively yourself so far.
This is about the Extbase-model for Frontend-users. So maybe let's put it in the Extbase-category.
This is a simplification of a way to get the actual groups that an FE user is a member of. \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication::fetchGroupData() will ask the authentication services to retrieve the group data. For the default authentication service the groups are retrieved recursively, filtered for double groups and with a check for circular dependencies.
Instead of a db query the same approach should be used to get the entire list of groups.
Looked it up in the core-code. I didn't know that way to do it through services. But yes, that looks nice. I'm unsure how to make it easily usable though (as part of Extbase, as a separate tool-function or whatever) without much code-duplication. Some parts in there are specific for the usecase (like collecting TS-settings).
Currently if some extension uses the Extbase-models to fetch the user-record for the current user "by hand" (takes uid from global variable, performs a findByUid on the repo) and then fetches groups no services are involved at all.
The way by using services seems like the right way to go for most such usecases imho, while "fetching a record" (through the repos) is more the lowlevel-way.
- Status changed from New to Closed
Also available in: Atom
PDF