获取Accesscontrol的分支ID [英] Getting the Branch ID for Accesscontrol

查看:48
本文介绍了获取Accesscontrol的分支ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在分支级别上限制特定AD组的权限.以前,我曾问过Microsoft Azure DevOps团队,他们是否对此请求有任何终结点URI REST API,但是我得到的答复是它当前不可用.但是,我设法使用chrome开发人员工具来获取API,

  https://dev.azure.com/{organization}/_apis/accesscontrolentries/{namespacetoken}?api-version = 5.1 

然后,我使用下面的这个主体发出POST请求,

  branchPermissionbody = {"token":"{}".format(permissionToken),合并":正确,"accessControlEntries":[{"descriptor":"Microsoft.TeamFoundation.Identity; {}".format(descriptorIdentifier),拒绝":4"extendedinfo":{}}]} 

许可令牌的格式为

  repoV2/{projectID}/{repositoryID}/refs/heads/{branchID}/ 

我们可以得到描述符标识符.

在这里,我被困在获取branchID上.例如,如果我们要限制的分支是 master support%5E ,我们如何使用开发人员工具来获取这些分支ID?

解决方案

您可以使用此工具将您的分支名称自动转换为分支ID.

然后使用此工具将 master 转换为十六进制.

这些值是相同的.那 support%5E

希望这会有所帮助.

I am trying to restrict the permissions for a specific AD group on a branch level. Previously I have asked the Microsoft Azure DevOps team if they had any endpoint URI REST API for this request, but the response that I have got was that it was not currently available. However, I have managed to get the API using the chrome developer tool, which was

https://dev.azure.com/{organization}/_apis/accesscontrolentries/{namespacetoken}?api-version=5.1

Then, I am making the POST request using this body below,

branchPermissionbody = {
                "token": "{}".format(permissionToken),
                "merge": True,
                "accessControlEntries": [
                    {
                        "descriptor": "Microsoft.TeamFoundation.Identity;{}".format(descriptorIdentifier),
                        "deny": 4,
                        "extendedinfo": {}
                    }
                ]
            }

The Permission Token, is in the format of ,

 repoV2/{projectID}/{repositoryID}/refs/heads/{branchID}/

and the descriptoridentier is something we can get.

Here, I am stuck on getting the branchID. For example, if the branch we are trying to restrict are master, support%5E, how do we grab these branch ID using the developer tool?

解决方案

You can use this tool to convert your branch name to branch id automatically. https://onlineunicodetools.com/convert-unicode-to-hex

For a test, I get my master branch id from Developer tool, it is 6d0061007300740065007200 like below.

And then use this tool to convert master to hex.

These values are same. Then what about support%5E

Hope this will help.

这篇关于获取Accesscontrol的分支ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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