npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@itwin/access-control-client

v4.0.0

Published

Access control client for the iTwin platform

Downloads

36,080

Readme

Access Control Client Library

npm version

A comprehensive TypeScript library for Bentley Systems' Access Control API, providing type-safe access to iTwin access management, roles, permissions, groups, and member operations.

Table of Contents

Quick Start

Get up and running with Access Control Client in just a few steps:

npm install @itwin/access-control-client
import { AccessControlClient } from "@itwin/access-control-client";

const client = new AccessControlClient();
const accessToken = "your-access-token-string";
const roles = await client.roles.getITwinRoles(accessToken, "itwin-id");
console.log(`Found ${roles.data!.length} roles`);

Installation

# Using npm
npm install @itwin/access-control-client

# Using yarn
yarn add @itwin/access-control-client

# Using pnpm
pnpm add @itwin/access-control-client

Basic Usage

Authentication

All API methods require an access token string. See the iTwin Platform documentation for authentication setup.

Environment Configuration

Configure different deployment environments using globalThis.IMJS_URL_PREFIX:

// Development environment
globalThis.IMJS_URL_PREFIX = "dev-";

// QA environment
globalThis.IMJS_URL_PREFIX = "qa-";

// Production (default)
globalThis.IMJS_URL_PREFIX = undefined;

Documentation

Core Documentation

| Document | Purpose | |----------|---------| | Getting Started Guide | Complete setup and first steps | | Migration Guide v3→v4 | Upgrading from v3.x to v4.x | | Contributing Guide | Development and contribution workflow |

API Reference

Core Classes

  • AccessControlClient - Main client for all access control operations
  • IAccessControlClient - Interface defining the client API surface

Sub-Clients

The AccessControlClient exposes the following specialized sub-clients:

Access Management

  • permissions - Query permissions across the platform and iTwins
  • roles - Manage iTwin roles (CRUD operations)

Group Management

  • groups - Manage iTwin groups (CRUD operations)
  • groupMembers - Manage members within groups
  • groupMemberInvitations - Handle group member invitation lifecycle

User Management

  • userMembers - Manage individual user members of iTwins
  • ownerMembers - Manage iTwin owner memberships
  • memberInvitations - Handle member invitation lifecycle

Advanced Operations

  • itwinJobs - Bulk operations for member management
  • itwinShares - Manage iTwin sharing and access tokens

Key Features

  • Complete CRUD operations for roles, groups, and members
  • Bulk operations via iTwin Jobs
  • Invitation management for users and groups
  • Sharing capabilities for controlled iTwin access
  • Type-safe API with full TypeScript support

Quick Reference

import { AccessControlClient } from "@itwin/access-control-client";
import type {
  BentleyAPIResponse,
  Role,
  MultipleUserMembersResponse
} from "@itwin/access-control-client";

const client = new AccessControlClient();
const accessToken = "your-access-token-string";
const iTwinId = "your-itwin-id";

// Get roles
const roles = await client.roles.getITwinRoles(accessToken, iTwinId);

// Create a role
const newRole = await client.roles.createITwinRole(accessToken, iTwinId, {
  displayName: "Project Manager",
  description: "Role for project management"
});

// Query user members
const members = await client.userMembers.queryITwinUserMembers(
  accessToken,
  iTwinId,
  { top: 10 }
);

// Add user members
const addedMembers = await client.userMembers.addITwinUserMembers(
  accessToken,
  iTwinId,
  [{
    email: "[email protected]",
    roleIds: ["role-id"]
  }],
  "Welcome message"
);

About this Repository

The @itwin/access-control-client package provides a modern, type-safe interface to Bentley Systems' Access Control API. It manages iTwin access permissions, roles, groups, members, invitations, and sharing capabilities.

For more information about the iTwin platform and APIs, visit:

Development

Prerequisites

  • Node.js 16+ and pnpm
  • TypeScript 4.5+
  • Valid iTwin Platform credentials

Building from Source

git clone https://github.com/iTwin/access-control-client.git
cd access-control-client
pnpm install
pnpm build

Running Tests

.env file setup is required for tests. View Getting Started for more information.

# Run all tests
pnpm test

# Run tests with coverage
pnpm test:coverage

# Run linting
pnpm lint

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • How to submit issues and feature requests
  • Development workflow and coding standards
  • Pull request process and review guidelines
  • Testing requirements and conventions
  • How to use changesets for versioning

Versioning

This project uses Changesets for version management. For more information view Contributing Guide.

License

Copyright © Bentley Systems, Incorporated. All rights reserved.

This project is licensed under the MIT License - see the LICENSE.md file for details.