I'm writing a C# method to fetch a user's group membership. I need to know, for each group, whether the user is a direct, or an indirect (due to group nesting) member.
My first attempt:
groupSearch.Filter = $"(&(objectCategory=group)(member:1.2.840.113556.1.4.1941:={userDistinguishedName})
This fetches both direct and indirect group memberships, but there is not way to distinguish the groups as direct or indirect.
My next attempt will be to get a list of only direct memberships, and another list of only indirect memberships, and then concatenate them. I know that a list of direct-only memberships can be fetched with the following filter:
groupSearch.Filter = $"(&(objectCategory=group)(member={userDistinguishedName})
Is there an equivalent way to get a list of indirect memberships? For example:
groupSearch.Filter = $"(&(objectCategory=group)(member-indirect={userDistinguishedName})
From the documentation it doesn't appear to be possible.