Not a bug Remnant Usergroup Permissions

woody

Well-known member
Affected version
2.1.7
I've cleaned up some unused usergroups, and have run every cache rebuild I can think of. When I access the Admin CP and head to:

ACP > Groups and Permissions > Analyze permissions ....and enter a user name for Global permissions, each option returns the following when you select "Details"

screenshot-forum.ih8mud.com-2020.01.png

Obviously, those 4 Usergroups should not be present, since they have been removed....and nothing exists...

A view-source confirms there are empty cells

Code:
[TABLE]
[TR]
[TD]<dl class="formRow">[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                <dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                    <div class="formRow-labelWrapper">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                    <label class="formRow-label">View</label></div>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                </dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                Yes[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        <a data-xf-click="toggle" role="button" tabindex="0">(Details)</a>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD][/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        <div class="toggleTarget">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>002- Registered</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        Yes[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>SuperMods</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        Yes[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>005- 500+ Club</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>ClubModerators</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt></dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt></dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>006- 10,000+</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt></dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt></dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>020- Charter</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>022- 10 Year</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            <dl class="pairs pairs--columns">[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dt>023- 15 Year</dt>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                <dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        No[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                            </dl>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                        </div>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                    [/TD]
[/TR]
[TR]
[TD][/TD]

[TD]                </dd>[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            </dl>[/TD]
[/TR]
[/TABLE]
 
@woody just to humour me for a second, if you edit the user you tried this with and click save without changing anything, do this still happen?
 
@woody just to humour me for a second, if you edit the user you tried this with and click save without changing anything, do this still happen?
FIXED!

At least for the two users I edited/saved (without doing anything else). (now three...hoping there is a "global" fix - lol)

Now to repeat that process for the 129,606 other site members.... /sic ;)
 
Unfortunately, I haven't been able to reproduce this and looking at the code, I think we handle this case.

We do have some post user group deletion handlers that insert jobs to remove users from the deleted group, which should trigger a bunch of other things (like changing permission combinations, etc). I can only guess that those didn't run, though I'm not sure of the reason. An add-on interfering isn't unheard of with this sort of thing, though I'm really not sure.

The difficult thing is that this isn't really easy to recover from. When you did the manual edit/save, it actually removes those bogus user group records from the user in question, but there isn't any tool to do that automatically. Changing group records also triggers a lot of extra work, so a simple query isn't really the way to go.

The most direct workaround I can think of is to try to more easily identify the users affected so that you can do the manual save via the UI. It'd only be members of those groups, so I'm hoping that's a relatively small number. I believe this query should identify them:

Code:
SELECT ugr.user_id, u.username, COUNT(*) AS total_invalid_groups
FROM xf_user_group_relation AS ugr
LEFT JOIN xf_user_group AS ug ON (ugr.user_group_id = ug.user_group_id)
LEFT JOIN xf_user AS u ON (ugr.user_id = u.user_id)
WHERE ug.user_group_id IS NULL
GROUP BY ugr.user_id;

You can then lookup the username in the ACP. If that's a huge number, we'll see if we can come up with any other ideas.
 
Back
Top Bottom