0

Visual Studio 2015 u2, building a Web extension, an action handler for a release definition context menu. I'd like my extension to manipulate the ACL on the def.

Is there a hook in the JavaScript client library for that? The REST API endpoint exists, but the JavaScript API documentation is woefully incomplete. Specifically, I could not find the list of modules that are available via VSS.require(), and that seems to be the proper way to get to REST API wrappers.

EDIT: okay, the module names seems to be listed here, which is derived from those sources on Github. Hardly official, but better than nothing.

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281

1 Answers1

0

There is no documentation, but I could find a type definition document at https://raw.githubusercontent.com/microsoft/vss-web-extension-sdk/master/typings/vss.d.ts . Specifically, if you look for "VSS/Security/RestClient", you'll find the list of methods in the API client. To use it, you can do the following:

VSS.require(["VSS/Service", "VSS/Security/RestClient"],
    function (Srv, SecAPI)
    {
         var SecClient = Srv.getCollectionClient(SecAPI.SecurityHttpClient);
         SecClient.queryAccessControlLists(NamespaceId, TokenId).then(function(a)
         {
              //...
         });
    });

Namespace ID comes from a querySecurityNamespaces() call, which is currently erroring out on me, but I could make it work from an external REST client (weird!). Not sure where does the TokenId from from. Maybe it's the release def ID.

EDIT: works like a charm with this monkey-patch in place.

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281