[TYPO3-mvc] Removing all FEUsergroups for a particular FEUser

Genser typo3 at genser.eu
Tue Mar 1 14:18:45 CET 2016


I wrote the following code to remove all FEUserGroups for a particular FEUser (to add new ones later on):

function removeAllGroupsForUser(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUserObj) {
	foreach ($feUserObj->getUserGroup() as $feUserGroupObj) {
		$feUserObj->removeUsergroup( $feUserGroupObj );
	}
}

(http://pastebin.com/aJReRMKX if you prefer a formated version of the code)

If I call the function once for a specific FEUser, for some reason one group remains assigned to that user.

A second call to the function cleans up the last group, but that should not be necessary.
Any ideas where I went wrong?



More information about the TYPO3-project-typo3v4mvc mailing list