public IsInGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : bool | ||
adUser | System.DirectoryServices.AccountManagement.UserPrincipal | The user |
groupName | string | The ID of the group to check for membership |
Résultat | bool |
public bool IsInGroup(UserPrincipal adUser, string groupName)
{
GroupPrincipal g = GroupPrincipal.FindByIdentity(Context, groupName);
return adUser.IsMemberOf(g);
}