Skip to main content

Access Control Service Overview

This document summarises the main data services exposed by access-control-client. Each service wraps Prisma models and enforces basic domain rules.

Core Data Services

ServicePurpose
UserDataServiceManage user accounts, passwords and profile fields
RoleDataServiceCRUD operations for roles and default permissions
PermissionDataServiceCreate and query permission definitions
UserRoleDataServiceLink users to roles within a tenant
SessionDataServiceIssue, validate and revoke user sessions
FeatureFlagsDataServiceToggle features at runtime for specific tenants or users

Required Environment Variables

VariableDescription
ACCESS_CONTROL_DATABASE_URLPostgreSQL connection string for the Prisma datasource
MAX_CONCURRENCYOptional limit for parallel queries in FeatureStatsDataService (defaults to 3)
CI_OFFLINE=truePrevents network calls during offline runs
SKIP_INTEGRATION=1Skip Docker based tests when containers are unavailable

Example Flows

1. User Creation

  1. Call UserDataService.createUser with email, password and tenant ID.
  2. UserRoleDataService assigns the default role for the tenant.
  3. Optionally create an invitation token so the user can activate their account.

2. Role Assignment

  1. Use RoleDataService.createRole to define a new role.
  2. Attach permissions via PermissionDataService or assign existing ones.
  3. Call UserRoleDataService.addRoleToUser to grant the role to a user.

3. Session Management

  1. SessionDataService.createSession issues a new session and refresh token.
  2. Persist the jti in cookies or headers for authenticated requests.
  3. SessionDataService.revokeSession or revokeAllSessionsForUser removes sessions when required.
  • Admin Capabilities — Platform vs tenant-scoped admins
  • Full seed taxonomy in libs/prisma/access-control-client/prisma/SEEDS.md