使用 VSTS REST API 设置团队或用户权限 [英] Setup team or users permissions with VSTS REST API
问题描述
是否可以通过 VSTS Rest API 设置团队或用户权限?
我只找到了很旧的帖子,并且没有关于该主题的任何更新.在 API 页面上,似乎可以为用户或组删除它们,但不能列出特定用户的权限或添加一些权限.
Is it possible to setup the teams or users permissions via the VSTS Rest 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.
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
.
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
Request body:
{"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}"}
The key points:
"Updates":[{"PermissionId":1, in the request body:
--> 0 means
Not set
,1 meansAllow
, 2 means Deny
Besides, you can use Permission Command to modify the user access control list (ACL) and displays authorization settings for an item under version control.
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屋!