Actions
Bug #83386
closedExtbase FrontendUser Class creates ObjectStorage for Usergroups only in constructor
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2017-12-19
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:
Description
The FrontendUser Class creates ObjectStorage for Usergroups only in the constructor, like this.
public function __construct($username = '', $password = '') { $this->username = $username; $this->password = $password; $this->usergroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); }
If no usergroup for the user is added upon creation of the frontenduser, it is not possible to simply add a new usergroup later. The reason is that $this->usergroup is null when fetching the frontenduser from the repository. I think this could be resolved with simply implementing an initializeObject() method in TYPO3\CMS\Extbase\Domain\Model\FrontendUser like this:
public function __construct($username = '', $password = '') { $this->username = $username; $this->password = $password; $this->initializeObject(); } public function initializeObject() { $this->usergroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); }
Actions