Поделиться через


Permissions

TFS 2017 | TFS 2015 | TFS 2013

Note

Looking for REST APIS that support TFS 2018 or later versions? See the Azure DevOps REST API Reference.

api-version = 2.0-preview.1

This API in preview. Learn more

Get permissions for a feed

GET https://{account}.Feeds.VisualStudio.com/DefaultCollection/_apis/packaging/feeds/{feed}/Permissions?api-version={version}
Parameter Type Notes
URL
account string VSTS organization.
feed string Name or ID of the feed.
Query
api-version string Version of the API to use.

Sample request

GET https://mytfsserver/DefaultCollection/_apis/packaging/feeds/EngineeringInternal/permissions?api-version=2.0-preview.1

Sample response

{
  "count": 3,
  "value": [
    {
      "role": "administrator",
      "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-2520422648-1909688902-2986275227-4210569620-1-653012555-3795782475-2724694617-2471557501"
    },
    {
      "role": "contributor",
      "identityDescriptor": "Microsoft.TeamFoundation.ServiceIdentity;185a8d6e-60c1-4b69-9ca6-ed9dcbbfa941:Build:6cb12e9f-c433-4ae5-9c34-553955d1a530"
    },
    {
      "role": "reader",
      "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-2712299484-177020235-2467464201-2866546392-1-2139524724-1218764870-2465287707-3992568220"
    }
  ]
}

Update permissions for a feed

PATCH https://{account}.Feeds.VisualStudio.com/DefaultCollection/_apis/packaging/feeds/{feed}/Permissions?api-version={version}
Parameter Type Notes
URL
account string VSTS organization.
feed string Name or ID of feed to be updated
Query
api-version string Version of the API to use.
Body
role enum 4 = owner, 3 = contributor, 2 = reader
identityDescriptor string Identity descriptor receiving an access level

Sample request

PATCH https://mytfsserver/DefaultCollection/_apis/packaging/feeds/EngineeringInternal/permissions?api-version=2.0-preview.1
[
  {
    "role": 3,
    "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-2520422648-1909688902-2986275227-4210569620-1-653012555-3795782475-2724694617-2471557501"
  }
]

Sample response

{
  "count": 1,
  "value": [
    {
      "role": "contributor",
      "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-2520422648-1909688902-2986275227-4210569620-1-653012555-3795782475-2724694617-2471557501"
    }
  ]
}

Get Package Management permissions

GET https://{account}.Feeds.VisualStudio.com/DefaultCollection/_apis/packaging/globalpermissions?api-version={version}
Parameter Type Notes
URL
account string VSTS organization.
Query
api-version string Version of the API to use.

Sample request

GET https://mytfsserver/DefaultCollection/_apis/packaging/globalpermissions?api-version=2.0-preview.1

Sample response

{
  "count": 2,
  "value": [
    {
      "role": "none",
      "identityDescriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;00000030-0000-8888-8000-000000000000@2c895908-04e0-4952-89fd-54b0046d6288"
    },
    {
      "role": "FeedCreator",
      "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-1"
    }
  ]
}

Update Package Management permissions

PATCH https://{account}.Feeds.VisualStudio.com/DefaultCollection/_apis/packaging/globalpermissions?api-version={version}
Parameter Type Notes
URL
account string VSTS organization.
Query
api-version string [Version/azure/devops/integrate/concepts/rest-api-versioning) of the API to use.
Body
role enum 2 = FeedCreator, 1 = None
identityDescriptor string Identity descriptor receiving an access level

Sample request

PATCH https://mytfsserver/DefaultCollection/_apis/packaging/globalpermissions?api-version=2.0-preview.1
[
  {
    "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-3",
    "role": 2
  },
  {
    "identityDescriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;afd9e15b-cb4a-4adb-931b-8cc520a03c36",
    "role": 1
  }
]

Sample response

{
  "count": 2,
  "value": [
    {
      "role": "none",
      "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-1"
    },
    {
      "role": "feedCreator",
      "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-3"
    }
  ]
}

Grant and remove permissions to 'Everyone'

In order to allow or deny everyone access to create feeds, you'll need to use the special identityDescriptor that represents the Everyone group:

Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-3

The previous sample request would grant permissions to everyone. Use a request similar to the following to remove permission from Everyone, so only Project Collection Administrators are able to create feeds:

Sample request

PATCH https://mytfsserver/DefaultCollection/_apis/packaging/globalpermissions?api-version=2.0-preview.1
[
  {
    "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-3",
    "role": 1
  }
]

Sample response

{
  "count": 2,
  "value": [
    {
      "role": "none",
      "identityDescriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;00000030-0000-8888-8000-000000000000@2c895908-04e0-4952-89fd-54b0046d6288"
    },
    {
      "role": "none",
      "identityDescriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-1"
    }
  ]
}