VSTS REST API的设置团队或用户权限 [英] Setup team or users permissions with VSTS REST API

查看:91
本文介绍了VSTS REST API的设置团队或用户权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过VSTS Rest API设置团队或用户权限?

Is it possible to setup the teams or users permissions via the VSTS Rest API ?

我只发现了很老的帖子,并且对该主题没有任何更新. 在API页面上,似乎可以为用户或组删除它们,但不能列出特定用户的权限或添加一些权限.

I've only found posts that are quite old and without any update on the subject. On the API page it seems like it would be possible to remove them for users or groups but not list the permissions for a specific user or add some.

https://docs.microsoft.com/zh-cn/rest/api/vsts/security/permissions/remove%20permission?view=vsts-rest-4.1

推荐答案

未记录REST API,但是您可以通过提琴手,或在Chrome浏览器中按 F12 ,然后选择Network.

The REST API is not documented, however you can track it by tools such as Fiddler or press F12 in Chrome browser then select Network.

例如我可以使用下面的REST API在下面的示例中为我的团队Team0416Delete team project权限设置为Allow:

e.g. I can use below REST API To set the Delete team project permission to Allow for my team Team0416 in below sample:

POST https://{account}.visualstudio.com/{Project}/_api/_security/ManagePermissions?__v=5

请求正文:

{"updatePackage":"{\"IsRemovingIdentity\":false,\"TeamFoundationId\":\"18de9da7-7edc-4c1d-88e0-e2420020e6dd\",\"DescriptorIdentityType\":\"Microsoft.TeamFoundation.Identity\",\"DescriptorIdentifier\":\"S-1-9-1551374245-717605811-4129483085-2927145651-87449592-1-853620709-4198499904-2869176592-1434840851\",\"PermissionSetId\":\"52d39943-cb85-4d7f-8fa8-c6baac873819\",\"PermissionSetToken\":\"vstfs:///Classification/TeamProject/b3cbc52a-22f6-4de9-ae78-b2b305365ff8\",\"RefreshIdentities\":false,\"Updates\":[{\"PermissionId\":1,\"PermissionBit\":4,\"NamespaceId\":\"52d39943-cb85-4d7f-8fa8-c6baac873819\",\"Token\":\"$PROJECT:vstfs:///Classification/TeamProject/b3cbc52a-22f6-4de9-ae78-b2b305365ff8:\"}],\"TokenDisplayName\":null}"}

关键点:

更新":[{\"PermissionId \" : 1 ,位于请求正文中:

"Updates\":[{\"PermissionId\":1, in the request body:

-> 0 表示Not set 1 表示Allow 2 表示 Deny

--> 0 means Not set,1 means Allow, 2 means Deny

此外,您可以使用权限命令修改用户访问控制列表(ACL),并显示受版本控制的项目的授权设置.

Besides, you can use Permission Command to modify the user access control list (ACL) and displays authorization settings for an item under version control.

并且您可以使用 TFSSecurity命令线工具,除了修改组和用户的权限之外,还可以在TFS中创建,修改和删除组和用户.

And you can use the TFSSecurity command-line tool to create, modify, and delete groups and users in TFS, in addition to modifying permissions for groups and users.

这篇关于VSTS REST API的设置团队或用户权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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