TFS 2013 获取所有 TFS 组,包括 Windows 组 [英] TFS 2013 get All TFS group including Windows group

查看:23
本文介绍了TFS 2013 获取所有 TFS 组,包括 Windows 组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理这个 TFS 2013 以获得所有 TFS 组的项目级别权限.但我无法获得 windows 组.我使用以下代码列出组:

I am working on this TFS 2013 to get the project level permission of all the TFS group. But I cannot get the windows group. I use the following code to list the groups:

var applicationGroups = identityManagementService.ListApplicationGroups(project.Uri.AbsoluteUri, ReadIdentityOptions.None);

但此代码只会列出 Teams ([project]\Project Team) 和 VSO 组 ([project]\Build Administrators, [project]\Contributors) 下的那些 TFS 组, [project]\Readers, [project]\Project Administrators, [project]\Project Valid Users, [project]\TFS_Build_Administrators, [project]\TFS_Build_Readers) 但不是 Windows 组(TFS_Builder, TFS_DEV_AM...) .

But this code will only list those TFS groups that are under Teams ([project]\Project Team) and VSO groups ([project]\Build Administrators, [project]\Contributors, [project]\Readers, [project]\Project Administrators, [project]\Project Valid Users, [project]\TFS_Build_Administrators, [project]\TFS_Build_Readers) but not Windows groups (TFS_Builder, TFS_DEV_AM...) .

有谁知道我如何做到这一点,或者为什么我无法在 Windows 组下获得这些?

Does anyone know how I can do this or why I wasn't able to get those under Windows groups?

您好,非常感谢您的回复.但我实际上是想查询所有这些窗口组,然后我将尝试确定每个组的成员是谁.您的回答也是正确的,但它仅适用于单个用户并尝试获取 memberOf 以便我们知道哪个 Windows 组是用户的 memberOf.我只是将它标记为 yes 因为我找到了一种方法来通过该代码列出它.但我不确定我是否可以再次为此发布另一个问题.反正.以下是适用于 TFS 2013 的新代码,因为 IGroupSecurityService 已过时.

Hi Thank you very much for replying. But I was actually looking to query all those windows groups and from there I will try to identify who are the members of each group. Your answer is also correct but it is only applicable for an individual user and try get the memberOf inorder for us to know which windows group is the user a memberOf. I just marked it as yes coz I found a way on how I could list it through that code. But I'm not sure if I might post another question for this again. Anyway. Below is the new code that is for TFS 2013 as the IGroupSecurityService is obsolete.

var collection = new TfsTeamProjectCollection(new Uri("http://mytfs:8080/tfs/MyCollection"));
var identityService = collection.GetService<IIdentityManagementService>();
var readIdentity = identityService.ReadIdentity(IdentitySearchFactory.AccountName, @"[domailName here]\" + userName, MembershipQuery.Direct, ReadIdentityOptions.None);

推荐答案

Windows 组不是存储在 TFS 中,而是存储在 Active Directory 中.要通过 TFS 查询 Active Directory,请使用:

Windows groups are not stored in TFS, but in Active Directory. To query Active Directory through TFS, use:

var collection = new TfsTeamProjectCollection(new Uri("http://mytfs:8080/tfs/MyCollection"));
var gss = collection.GetService<IGroupSecurityService>();
Identity i = gss.ReadIdentity(SearchFactor.AccountName, "myalias", QueryMembership.Direct);

这是一个用户,您也可以尝试通过它获取群组.

That's a user, you can try getting groups through it as well.

这篇关于TFS 2013 获取所有 TFS 组,包括 Windows 组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆