验证用户在AD组中 [英] Verify the user is in the AD group
问题描述
大家好,
我想验证用户所在的组,并在验证时返回true或false.
I want to verify the groups which a user is present in, and return true or false on validation.
它正在像以下分组中提取信息:
It is pulling the information in groups like:
CN = testGroup,OU = identityMinder,OU =应用程序组,OU =公司名称,OU =组,OU =用户和组,DC =我们,DC =我的公司,DC = com
CN=testGroup,OU=identityMinder,OU=ApplicationGroups,OU=companyname,OU=Groups,OU=usersAndGroups,DC=us,DC=mycompany,DC=com
当我尝试验证时,是否为
testGroup 如果是
testGroup1 说的是真的.
When I'm trying to validate, if it is
testGroup it is sayng true, if it is
testGroup1 it is saying true.
如果它是testGroup1,则应该说是假.
如何仅将CN与组名进行比较.
If it is testGroup1 it should say false.
How to compare just the CN with the groupname.
推荐答案
克里希纳嗨.
您为什么要使用包含"
Why are you using the "Contains" method in
if (g.Contains(groupName))
{
isInGroup = true;
break;
}
此代码段?
尝试使用.等于
这篇关于验证用户在AD组中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!