- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 ASP.Net 4.0 MVC 查询事件目录。我正在尝试获取用户组成员身份的列表并遍历它们。我有一个奇怪的问题。要获取我正在使用的组:
PrincipalSearchResult<Principal> groups = up.GetGroups();
它在本地主机上运行良好,但在移动到 IIS6 时返回一个空集。所以我尝试使用这个:
PrincipalSearchResult<Principal> groups = up.GetAuthorizationGroups();
这在 IIS6 上运行良好,但在本地主机上返回一个空集。这两种方法有什么区别?为什么我可以在 IIS6 中使用,而不能在本地主机上使用?为什么我可以在本地主机上使用另一个,而不能在 IIS6 中使用?
最佳答案
“为什么”部分已经得到解答,但这可能会帮助那些想知道这两种方法之间功能差异的人。来自 MS 文档:
GetGroups - Returns a collection of group objects that specify the groups of which the current principal is a member.
This overloaded method only returns the groups of which the principal is directly a member; no recursive searches are performed.
GetAuthorizationGroups - Returns a collection of principal objects that contains all the authorization groups of which this user is a member. This function only returns groups that are security groups; distribution groups are not returned.
This method searches all groups recursively and returns the groups in which the user is a member. The returned set may also include additional groups that system would consider the user a member of for authorization purposes.
因此 GetGroups
获取用户是其直接 成员的所有 组,GetAuthorizationGroups
获取所有<用户是其直接或间接成员的strong>授权组。
不管它们的命名方式如何,一个都不是另一个的子集。 GetGroups
返回的组可能不是 GetAuthorizationGroups
返回的,反之亦然。
关于c# - UserPrincipal.GetGroups 与 UserPrincipal.GetAuthorizationGroups?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11162008/
我在 root 中运行这个程序,使用命令 id mike 得到以下结果: uid=1001(mike) gid=1002(mike) groups=1002(mike),1005(mynewgroup
extern crate libc; fn example(guid: u32) { unsafe { let ruid = libc::getuid(); l
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeNetworkManager.getGroups()方法的一些代码示例,展示了ZigBeeNetworkManager
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeNetworkManager.getGroup()方法的一些代码示例,展示了ZigBeeNetworkManager.
我正在使用 ASP.Net 4.0 MVC 查询事件目录。我正在尝试获取用户组成员身份的列表并遍历它们。我有一个奇怪的问题。要获取我正在使用的组: PrincipalSearchResult g
本文整理了Java中ro.isdc.wro.model.WroModel.getGroups()方法的一些代码示例,展示了WroModel.getGroups()的具体用法。这些代码示例主要来源于Gi
我正在尝试使用 UserPrincipal 的 GetGroups 方法。如果用户帐户位于包含正斜杠的 OU 中,则对 GetGroups 的调用将失败并出现 COM 未知错误 0x80005000。
以下内容在我的本地开发盒上效果很好。但是,当我将它移动到 Web 服务器时,它失败了,甚至不会记录错误: public static List getAuthorizationGrps(string
背景 我们有一个用 C# 编写的 asp.net 4.0 Web 应用程序调用用 C# 编写的 .net 3.5 Web 服务。 Web 服务被传递一个用户 ID 并根据用户所属的事件目录组返回一个数
本文整理了Java中com.ait.lienzo.client.core.shape.wires.WiresShape.getGroup()方法的一些代码示例,展示了WiresShape.getGro
我是一名优秀的程序员,十分优秀!