UNPKG

@itwin/access-control-client

Version:

Access control client for the iTwin platform

40 lines 1.78 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module AccessControlClient */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PermissionsClient = void 0; const BaseClient_1 = require("./BaseClient"); /** Client API to perform iTwin permission operations. */ class PermissionsClient extends BaseClient_1.BaseClient { /** Create a new PermissionsClient instance * @param url Optional base URL for the access control service. If not provided, defaults to base url. */ constructor(url) { super(url); } /** Retrieves the list of all available permissions * @param accessToken The client access token string * @returns Array of permissions */ async getPermissions(accessToken) { const url = `${this._baseUrl}/permissions`; return this.sendGenericAPIRequest(accessToken, "GET", url, undefined, "permissions"); } /** Retrieves a list of permissions the identity has for a specified iTwin * @param accessToken The client access token string * @param iTwinId The id of the iTwin * @returns Array of permissions */ async getITwinPermissions(accessToken, iTwinId) { const url = `${this._baseUrl}/${iTwinId}/permissions`; return this.sendGenericAPIRequest(accessToken, "GET", url, undefined, "permissions"); } } exports.PermissionsClient = PermissionsClient; //# sourceMappingURL=PermissionsClient.js.map