以特定用户身份更改 TFS 工作项 [英] Make Changes to a TFS Work Item as a specific user

查看:24
本文介绍了以特定用户身份更改 TFS 工作项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 Web 应用程序,我的团队中的用户将使用它对 TFS 工作项进行更改.我为此使用了 TFS API..

I am working on creating a Web application, which the users in my team will use to make changes to TFS Work Items. I am using TFS API for this..

为了访问 TFS 服务器,我在 Web 应用程序中使用了我的凭据.

In order to access the TFS Server , I used my credentials within the Web Application.

现在每次有人使用该应用程序并对 TFS 工作项进行更改时,它都会显示好像我在应用程序中使用了我的凭据后对这些项目进行了更改.

Now each time someone uses the application and makes changes to TFS work items, it shows as if I have made changes to these items since my credentials are being used in the application.

有没有办法可以使用登录我的应用程序的人的凭据在 TFS 上显示为进行更改的人?

Is there a way I can use the credentials of the person logging into my application to show up on TFS as the person making the changes ?

推荐答案

您需要使用代表他人发出请求"功能.您可以通过以下方式模拟其他用户:

You need to use the 'make requests on behalf of others' functionality. You can impersonate another user by following:

public void Impersonation(Uri serverUri,string userToImpersonate)
{
    // Read out the identity of the user we want to impersonate
    TeamFoundationIdentity identity = ims.ReadIdentity(IdentitySearchFactor.AccountName, 
        userToImpersonate,
        MembershipQuery.None, 
        ReadIdentityOptions.None);

    tfs_impersonated = new TfsTeamProjectCollection(serverUri, identity.Descriptor);

    GetAuthenticatedIdentity(tfs_impersonated);

    // Use this tfs_impersonated object to communicate to TFS as the other users.
}

并确保您运行该网站的帐户具有代表他人提出请求"的权限:

And make sure your account running the website has the permission to "make requests on behalf of others":

http://www.codeproject.com/Articles/104019/TFS-API-Part-TFS-Impersonation

这篇关于以特定用户身份更改 TFS 工作项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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