Feature #14822
closed
Group membership defined by MM relation instead of text field.
Added by old_Pic2008 over 19 years ago.
Updated about 6 years ago.
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)
yes this would be very nice but does have a hug impact. Hopefully will be adressed in V 5.0
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.
It also works without REGEX
SELECT * FROM `be_users` WHERE FIND_IN_SET('###groupid###', usergroup)>0
thx for the pointer. IMO this is still not a real solution though.
it exists an dbal safe function in class.t3lib_db.php for this purpose.
see function listQuery
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.
- Status changed from Resolved to Closed
Also available in: Atom
PDF