Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Active directory 特定计算机中组的用户成员?_Active Directory_Local_Membership_Active Directory Group - Fatal编程技术网

Active directory 特定计算机中组的用户成员?

Active directory 特定计算机中组的用户成员?,active-directory,local,membership,active-directory-group,Active Directory,Local,Membership,Active Directory Group,我正在编写一个web应用程序,并尝试对管理员用户进行身份验证。我希望通过在服务器上建立一个本地组来实现这一点,并将域用户添加到该服务器中。我有一个名为ProductionManagers的小组,我将拥有管理员权限的人员添加到其中。其他用户只有查看权限 我想做的是在服务器上搜索并查询广告(对吗?),然后确定当前登录的用户是否是ProductionManager组的成员(该组是服务器上的一个组,而不是域组) 最好的方法是什么?或者您有一个建议,建议使用一个比使用本地组添加管理员更好的机制?如果使用A

我正在编写一个web应用程序,并尝试对管理员用户进行身份验证。我希望通过在服务器上建立一个本地组来实现这一点,并将域用户添加到该服务器中。我有一个名为
ProductionManagers
的小组,我将拥有管理员权限的人员添加到其中。其他用户只有查看权限

我想做的是在服务器上搜索并查询广告(对吗?),然后确定当前登录的用户是否是
ProductionManager
组的成员(该组是服务器上的一个组,而不是域组)


最好的方法是什么?或者您有一个建议,建议使用一个比使用本地组添加管理员更好的机制?

如果使用ASP.NET和表单身份验证

WindowsPrincipal principal = new WindowsPrincipal(new WindowsIdentity("youruser@domain.com"));
if (principal.IsInRole("ProductionManagers"))
{
   // Authenticated
}
WindowsPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
if (principal.IsInRole("ProductionManagers"))
{
   // Authenticated
}
如果使用ASP.NET和Windows身份验证

WindowsPrincipal principal = new WindowsPrincipal(new WindowsIdentity("youruser@domain.com"));
if (principal.IsInRole("ProductionManagers"))
{
   // Authenticated
}
WindowsPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
if (principal.IsInRole("ProductionManagers"))
{
   // Authenticated
}
如果使用Java、PHP、Ruby等其他工具,则需要调用.NETAPI或Win32 API来实现这一点。您不能简单地通过LDAP查询来检索该信息。原因是本地组的组成员信息实际上存储在本地计算机上,而不是Active Directory上


您需要拨打类似的电话从本地商店检索组成员信息。

谢谢。我试试看。不幸的是,我现在退出了那个项目。希望我能很快有时间再做一次:)