So, I have a question regarding recursive groups in the active directory. I have a small method that checks if a user id is in a group or not. It works great. Today it turned out that he does not check for recursive group membership, and I'm not too sure how (or if) there is a way to do this. Here is what I'm still not recursive:
public static bool CheckGroupMembership(string userID, string groupName, string Domain) { bool isMember = false; PrincipalContext ADDomain = new PrincipalContext(ContextType.Domain, Domain); UserPrincipal user = UserPrincipal.FindByIdentity(ADDomain, userID); if (user.IsMemberOf(ADDomain, IdentityType.Name, groupName.Trim())) { isMember = true; } return isMember; }
I saw something about a directory search engine or something like that, but I'm a little new to working with AD, and although I understand the concepts, some other things are still a bit lost for me.
Thanks!
Seril
source share