TFS REST API: how to "Make requests on behalf of others"?

I want my VSTS extension (installed by default TFS2015.3) to be able to execute specific requests on behalf of the administrator / service account ("Make requests on behalf of others")

Reference Information. I am manipulating (WorkItem) the Process Template, especially GLOBALWORKFLOW (only at the project level) in my typescript extensions, but the extension user in Web Access is NOT a project administrator, so he is not allowed to use the updateWorkItemTypeDefinition () function - non-Project-Admins get "Access denied", even if I gave this custom group all the permissions ("Change project-level information" permissions for GLOBALWORKFLOW at the project level? Still not working for custom groups, only for project admin accounts that).

I seem to be forced to impersonate a project / service administrator account that permits changing the global workflow in the project

How I impersonate the extension of typescript code on-prem TFS and REST (1. not .NET and 2. without switching to basic auth, I saw this solution somewhere else, but I'm sure I can not request this change in my organization)

thanks for the help

+4
source share
1 answer

You can impersonate a user through vsts-node-api.

There are many features to impersonate the user, such as Basic, NTLM, PWA (VSTS), etc ..., you can check these features here .

import * as vm from 'vso-node-api';

// your collection url
var collectionUrl = "XXX";


let authHandler = vm.getNtlmHandler("[user name]","[password]","[workstation optional]","[domain optional]"); 

var connect = new vm.WebApi(collectionUrl, authHandler);   

There is a sample here that you can refer to.

+1
source

Source: https://habr.com/ru/post/1656673/


All Articles