Feature #14822
closedGroup membership defined by MM relation instead of text field.
0%
Description
The usergroup memberships for backend and frontend users is currently defined by a comma separated string stored in a binary data field.
This makes getting users from the DB based on what group they belong to cumbersome and inefficient as it requires using the REGEXP operator (more specifically: SELECT * FROM be_users WHERE usergroup REGEXP '(,|^)<group_id>(,|$)';).
Replacing this with a many-to-many relationship in the next major revision of Typo3 would in my eyes be a good thing.
(issue imported from #M1203)
Updated by Peter Niederlag about 19 years ago
yes this would be very nice but does have a hug impact. Hopefully will be adressed in V 5.0
Updated by old_djluc almost 19 years ago
Isn't is possible to keep a modern shadow table:
So we create a MM table, just like the relations have to be in modern extensions. Then we attach a function to the update/insert hook from fe_users. When updating a record the group-assignment will be saved komma seperated in the fe_user.usergroup field but also in the MM table so we can use the values in a normal way, with a nice query.
Updated by Christoph Lemmer over 16 years ago
It also works without REGEX
SELECT * FROM `be_users` WHERE FIND_IN_SET('###groupid###', usergroup)>0
Updated by Peter Niederlag over 16 years ago
thx for the pointer. IMO this is still not a real solution though.
Updated by Alex Widschwendter over 16 years ago
it exists an dbal safe function in class.t3lib_db.php for this purpose.
see function listQuery
Updated by Christian Kuhn over 15 years ago
Resolved, won't fix.
This comma-separated-list of ID's concept is found for several relations throughout the core. I don't expect it to be replaced soon, even if it's not optimal from a database point of view.
For now I resolve this issue with "won't fix" until someone comes up with a working concept (including backwards compatibility) not breaking too much. Feel free to work on this.
Furthermore a be / fe user is usually only member of a small set of group, so we usually don't search an id in a huge list, which is not a perfect, but a practical approach. Extensions still can use real mm relations, though.