@itwin/access-control-client
Version:
Access control client for the iTwin platform
36 lines • 1.62 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* 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
*/
import { BaseClient } from "./BaseClient";
/** Client API to perform iTwin permission operations.
*/
export class PermissionsClient extends 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");
}
}
//# sourceMappingURL=PermissionsClient.js.map