如何列出不再属于任何安全组的旧 TFS 用户?
有很多示例展示了如何获取当前 TFS 用户的列表,但是如何获取过去已提交更改但不再属于任何安全组的旧用户列表?
作为记录,这是我用来查找所有当前用户的代码:
var gss = tfs.GetService<IGroupSecurityService>();
var members = gss.ReadIdentity(SearchFactor.EveryoneApplicationGroup,
null,
QueryMembership.Expanded).Members;
return gss.ReadIdentities(SearchFactor.Sid, members, QueryMembership.None)
.Where(identity => identity != null &&
identity.Type == IdentityType.WindowsUser)
.Select(identity => string.Format(@"{0}\{1}",
identity.Domain,
identity.AccountName));
There are lots of examples around that show how to get a list of current TFS users, but how do I get a list of old users that have commit changes in the past but no longer belong to any security groups?
For the record, this is the code I'm using to find all current users:
var gss = tfs.GetService<IGroupSecurityService>();
var members = gss.ReadIdentity(SearchFactor.EveryoneApplicationGroup,
null,
QueryMembership.Expanded).Members;
return gss.ReadIdentities(SearchFactor.Sid, members, QueryMembership.None)
.Where(identity => identity != null &&
identity.Type == IdentityType.WindowsUser)
.Select(identity => string.Format(@"{0}\{1}",
identity.Domain,
identity.AccountName));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法提供确切的答案,但希望这会有所帮助...
您可以通过工作区(即 tf.exe 工作区命令和等效 api)列出所有待处理的更改。使用每个工作区的所有者以及未提交的更改,您应该能够交叉引用您已经拥有的活动用户列表。
I can't offer an exact answer, but hopefully this will help...
You can list all pending changes through the workspaces (i.e. tf.exe workspaces command and equivalent apis). Using the owner of each workspace with uncommitted changes you should then be able to cross-reference against the list of active users you've already got.
以下代码片段应该揭示曾经在 TeamCollection 存储库中提交更改的每个人:
请注意,这是一种蛮力,并且由于存在大量更改集,因此需要相当长的时间来执行。
The following snippet should reveal each and every person that has ever committed changes in your TeamCollection repository:
Beware that this is a brute force, and, with a lot of changesets, it would take considerable time to execute.