NodeBB icon indicating copy to clipboard operation
NodeBB copied to clipboard

Banned User not being removed from Groups

Open uplift opened this issue 2 years ago • 4 comments

When a user is banned they are only removed from system groups (except Banned Users group) but aren't removed from custom created groups. Is this intentional behaviour?

If so, is it possible to add options in Admin to select whether to remove from all groups or to have a list of groups to remove from on ban?

Currently I'm using the ban action hook to remove from custom groups but it doesnt allow the Community Managers to manage that list if and when they add a new group.

uplift avatar May 30 '22 11:05 uplift

Hmm... without knowing the full context, I would guess that this was intentional insomuch that we don't know what groups to re-add the user to upon unban or ban expiry.

There are two approaches here—either we remove the user from all non-system groups (toggleable via feature flag), or we update the getMembers (and other variants) method to filter out banned users.

Directly checking group:${groupName}:members would return banned uids, as is normal.

julianlam avatar Jun 08 '22 16:06 julianlam

Sorry for the slow reply, this must have got lost in my emails when I was away.

Prior to the change to put banned users in a group (instead of preventing them from being logged in), banned users were treated as guests. Assuming that is true of all setups and not just my version?

Makes sense to me that when banned they should be placed in the banned group and removed from all groups (like a guest would have been treated as previously). Then privileges for the banned group could be tailored for any extra/reduced access they have than standard guest privileges.

Not sure of the pros and cons of updating getMembers approach as I don't know what other workflows it might affect in the forum.

uplift avatar Jul 13 '22 14:07 uplift

That approach might work, it's worth investigating

julianlam avatar Jul 13 '22 16:07 julianlam

Circling back, I think we may be able to do both, in the sense that banned users can be added to a "Banned Users" group, and they can also be removed from the group members' list on-the-fly.

Then we would be able to keep their group memberships upon unban.

julianlam avatar Aug 08 '22 19:08 julianlam