I was tasked with bringing the security groups into alignment so they were accurate. Several different objects are involved with security, so I needed to make sure they all lined up: the Group itself, Group Member, People, My Profile, and Group Details records. First, I did a deep dive into security to see what actually controls or grants access. I needed to know which object was the source of truth.
The answer was Group Member. As I investigated Group Member, I found that the users who couldn't be removed from the security group didn't have a corresponding Group Member record. The Delete action runs a workflow that calls custom Java code. That code looks for the Group Member record to remove it. If it can't find one, it doesn't do anything else and exits without an error.
Since Group and Group Member were out of sync, I wrote some SQL to check whether a My Profile record was in the Group, had a Group Member record, and was associated to the corresponding Group Details record. I also pulled the People record for that profile and checked whether it was associated to the Group Details record too.
The results showed security was out of sync across the board. Some users had Group Details records without being in the Group or Group Member records. Other profile records were associated to a group but weren't listed under the users on that group. Pretty much every object needed to be brought into alignment.
Since Group Member is what controls access, I knew users with Group Details or a group association, but no Group Member record, didn't actually have access. If someone had been missing access, it would have shown up in help desk tickets. So I decided to work from Group Member out.
I built a patch helper record that retrieved the Group Member records for a group and deassociated the group from the profile for any user on that group without a Group Member record. Then I retrieved every My Profile record associated to or from the group and fixed them:
- Removed the association from the profile if there was no Group Member record
- Added the association from My Profile if it was missing and a Group Member record existed
In the end, security was aligned across all of its component objects. The users who actually had access kept it, and the ones who didn't have access due to the misconfiguration had the group removed. If any of them actually should have access, they'll reach out when they realize they don't. So far, no one has.
Anyway, if you ever run into a situation where you can't remove a user from a security group's Members tab, now you know why.