Please look at these posts, they seem to have a problem like yours and got a solution:
How to get all the AD groups for a particular user?
Get all groups for a user using LDAP
If I misunderstood what you mean, please let me know.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.