【问题标题】:Is it possible to use the TFS SDK to query and edit Server Access Levels (Stakeholder, Basic, Advanced)是否可以使用 TFS SDK 来查询和编辑服务器访问级别(利益相关者、基本、高级)
【发布时间】:2016-01-20 07:44:48
【问题描述】:

我目前正在使用 TFS 2013(本地)。我无法找到一种方法来以编程方式查询在服务器级别的控制面板的“访问级别”选项卡中设置的“利益相关者”、“基本”和“高级”用户列表,或者,给定有效的 TeamFoundationIdentity,找出它们对应的访问级别是什么。可以这样做吗?

我对 SDK 的使用非常熟悉,尽管在查找用户和安全性时才合理。例如,我知道如何列出服务器上的所有项目集合有效用户。

TfsConfigurationServer configurationServer

IIdentityManagementService ims = configurationServer.GetService<IIdentityManagementService>();

TeamFoundationIdentity[][] identities = ims.ReadIdentities(IdentitySearchFactor.AccountName,
        new[] { "Project Collection Valid Users" }, MembershipQuery.Expanded, ReadIdentityOptions.ExtendedProperties);

任何帮助将不胜感激,谢谢。

【问题讨论】:

    标签: c# tfs permissions tfs-sdk tfs-security


    【解决方案1】:

    您可以使用 REST 客户端 API 读取用户的访问级别。

    String collectionUri = "https://{account}.visualstudio.com";
    VssCredentials creds = new VssClientCredentials();
    creds.Storage = new VssClientCredentialStorage();
    VssConnection connection = new VssConnection(new Uri(collectionUri), creds);
    var licensingHttpClient = connection.GetClient<LicensingHttpClient>();
    var accountEntitlement = licensingHttpClient.GetAccountEntitlementAsync().Result;
    var license = accountEntitlement.License;
    

    【讨论】:

    • 这应该适用于 TFS(内部部署)吗?我收到 VssResourceNotFoundException:API 资源位置 c01e9fd5-0d8c-4d5e-9a68-734bd8da6a38 未在 http://:8080/tfs/ 上注册
    • 我之前的评论指的是 TFS 2018
    【解决方案2】:

    不,这是不可能的。

    似乎没有关于如何使用 TFS API 查询和编辑服务器访问级别的官方文档。

    请参考以下类似帖子中的讨论: https://social.msdn.microsoft.com/Forums/vstudio/en-US/222245c1-5f72-4daa-bc0f-a038ee363bd8/querying-tfs-user-access-level-via-the-object-model?forum=tfsgeneral

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多