API scopes
Every bearer request to a routed REST listener must carry a scope accepted by that listener for the requested HTTP method. Scopes limit the API surface available to a token. SoloDB still applies the user's existing roles, entity permissions, input validation and operation rules. A scope does not assign a role or grant access to an otherwise forbidden run, room or piece of equipment.
Use the endpoint scope reference to select permissions for specific calls. For Microsoft tokens, see Entra API access and token exchange.
Permission structure
Scope names are stable, case-sensitive public values with the form Domain.Read or Domain.Write. Own-user and cross-user action permissions retain the existing Action.Read.Own and Action.Read.All names. User.Read.Own separates access to a user's own profile from directory access.
Permissions are independent. Run.Write does not include Run.Read, and Admin.Write does not include other domains or Admin.Read. Request both read and write when an integration needs both. There are no wildcards, prefix matching, or implicit grants for administrators. Action.Read.All is explicitly accepted on the own-action endpoint as well as cross-user action endpoints. Existing action scopes also remain accepted on /api/user/me for compatibility.
Each HTTP method has a list of accepted alternatives. Possessing one listed permission is sufficient; a client can request a space-separated bundle to call several endpoints. HEAD uses the GET policy unless a listener explicitly declares another policy. OPTIONS preflight is left to the existing CORS and routing handling. An undeclared method, an undeclared scope policy, or a non-API route denies bearer access.
Scope catalogue
Scope | Allowed operations | Additional restriction |
|---|---|---|
| Read actions assigned to the token's user, including closed actions, using | Active user; ownership comes from the token. |
| Read actions across users using | SoloDB administrator, or an explicitly authorized Entra application on the two cross-user endpoints. |
| Read the current user profile through | User tokens only. Does not expose the directory or actions. |
| List the user directory, retrieve user details, and look up badge-card users. | User tokens only. This is a SoloDB API permission; a Microsoft Graph token with the same text is not a SoloDB token. |
| Read equipment, modules, setups, reservations, statuses, ECNs and attachments, issues and attachments, external activity and types, parameters, status mail and equipment filter options. | Does not include monitor data. |
| Create/update/delete equipment reservations, manage setup equipment, record module changelogs, statuses and external activity, manage ECNs/issues and their attachments, and send status mail. | Existing equipment and reservation permissions still apply. Request |
| Read monitors and their requirements, targets, results, step parameter values, parameters and file lists. | Includes monitor endpoints stored under equipment listener folders. |
| Create/update/delete monitor results and parameter values, and upload monitor requirement files. | Uses the actual POST/PATCH/DELETE operation, including uploads with |
| Read chemicals, containers, external labels, container types, purposes and methods of use. | Does not permit changes to storage or removal state. |
| Create chemicals and containers, manage container users and external labels, move/delete containers, mark/unmark removal and set standard/non-standard product status. | Existing chemical and container permissions still apply. |
| Read runs, steps, parts and states, hold codes, requirements, measurements/results, parameters, checklists, files and changelogs. | Run access rules still apply. |
| Create runs and parent runs, add substrates/parts/trays, change part states and tray placement, manage execution and rework, update checklists/parameters/measurements, upload/remove files and update/remove batch cards. | Includes creating step-part actions. It does not grant cross-user action reads. Locks and operation permissions still apply. |
| Read rooms, zones, zone groups, storage locations, location messages and message types. | Existing room and location permissions still apply. |
| Create and update location messages. | Does not represent unimplemented room-management APIs. |
| Read process module recipes and recipe versions. | There is currently no routed process write endpoint. |
| List groups, projects and teams. | Does not change memberships. |
| List templates and template steps. | Does not modify templates. |
| List substrates. | Creating a substrate within a run uses |
| List services, read service event reports and list report results. | Existing service permissions still apply. |
| Update service event report results. | Does not include other domains. |
| List scheduler jobs and queues. | Does not start or alter scheduled work. |
| Upload a file through | Dedicated run and monitor upload endpoints use their domain's write scope. |
| Read Goldstein clients by token or current association. Returned client data can include sensitive association data. | SoloDB administrator required; user tokens only. |
| Onboard badges, create/update Goldstein clients and record Goldstein action logs. | SoloDB administrator required; user tokens only. |
All user-token requests require an active local user. A token containing an administrator permission is rejected if that user no longer has the administrator role. Application identities have no local user and remain limited to Action.Read.All on the two cross-user action read endpoints. Giving an application another scope does not enable access to a user-dependent domain endpoint.
SCIM provisioning at /scim/v2/... uses its separate service credential and provisioning permissions. OAuth token issuance, login routes and browser pages are not additional REST scope domains.
Create and assign scopes
Api\OAuth\ApiScope is the catalogue of supported permission names and descriptions. Inspect it through the CLI using the appropriate host wrapper. For example:
The second command creates missing atomic supported scope records with Is default disabled. It is safe to repeat: existing records, defaults, service settings and client assignments are left unchanged. No database schema change is needed. Run this on each target host database as part of deploying the new scope policies.
Under Admin → OAuth2 → Scopes, create a non-default bundle record when a client needs multiple permissions. For example, Equipment.Read Run.Read Run.Write gives an integration equipment lookups plus run reads and writes. Assign that bundle to the intended client under Admin → OAuth2 → Clients. The atomic supported records must also exist: the OAuth storage checks individual requested scope names against exact database rows. A bundle record alone does not register its component permissions. Keep API permissions non-default so they are requested and assigned deliberately.
For Entra delegated access, expose and consent to each required short scope name on the SoloDB API resource registration. Add the same names to the Microsoft service's Allowed Entra API scopes. For a local exchange, also include them in the local client's scope bundle and request them in the exchange's scope field. The granted set is the intersection of the catalogue, service allow list, client allow list and signed Entra permissions. Direct Entra calls use the catalogue, service allow list and signed permissions. The linked user's local privileges are checked in either flow.
Omitting scope on the Entra exchange retains the existing Action.Read.Own default. Request domain scopes explicitly. Scoped bearer identities use non-persistent authentication storage and cannot establish browser sessions. The legacy /oauth/refresh shortcut refuses API-scoped tokens; acquire a new token from its issuer. Entra exchange tokens do not receive refresh tokens.
Migrate existing integrations
Deploy the shared api-tools changes and the SoloDB changes together. When testing with the local Composer symlink in Docker, include docker-compose.local-api-tools.yml so the sibling package is available inside the containers. For a release, publish the shared package first and update SoloDB's dependency to that released version. Clear the normal module configuration cache and restart web processes after deployment.
Review each integration's calls against the endpoint reference, register the supported permissions, assign an explicit client bundle, update the service and Entra delegated grants when applicable, and acquire a new token. Existing tokens with only openid, an empty scope, or unrelated permissions receive 403 insufficient_scope on routed API endpoints. There is no legacy bearer bypass. User.Read now permits the user directory endpoints only; it is not general API access. User-interface requests without an OAuth identity retain their existing session and authorization flow, except the action and /api/user/me endpoints that already require an API token.
For a refused request, 401 invalid_token indicates an expired, missing or revoked identity. 403 insufficient_scope indicates an ungranted endpoint/method, an administrator restriction or an application restriction. The WWW-Authenticate header reports accepted scope alternatives when available. A passing scope check can still be followed by a denial from an existing entity permission check.
Declare scopes on a listener
The shared AbstractRoutedListener provides $scopes, $applicationScopes and $requireAccessToken alongside $route and the collection whitelist. Declare the actual HTTP method, independently of the route's spelling:
Use several values for alternatives, such as accepting either own or all action reads. The default empty policy denies bearer access until a listener declares its permissions. $requireAccessToken = true additionally rejects requests without an API identity, even if a browser session exists. $applicationScopes is an additional allow list for service principals; leaving it empty rejects application identities.
Jield\ApiTools\OAuth2\AbstractListenerScopeGuard implements method matching, expiry checks, deny-by-default bearer boundaries and OAuth error responses. It runs after authentication and HTTP method overrides, before SoloDB authorization. SoloDB's ApiScopeGuard service extends it and applies local user activity, administrator requirements, Entra identity markers and service/client revocation checks. Listeners rely on this central guard for access-token, expiry, scope and active-user checks. Keep request validation, resource lookup and entity-specific permissions in the listener or domain service. Direct Entra authentication discovers scope-enabled listeners through their metadata; no controller list is maintained. Shared Scope and TokenExchange classes provide scope parsing and protocol constants. The shared EntraIdentity helper reads validated claims and formats application subjects; SoloDB supplies ApiScope::applicationScopes() as the application permission allow list. Public permission names live in ApiScope without an action-specific wrapper.
When adding a domain permission, add it to ApiScope, assign it to the appropriate listener methods, update this catalogue and the endpoint reference, and register its supported database record on each host. Keep names stable and avoid adding scopes without implemented endpoints. ListenerScopesTest checks every discovered listener against the catalogue, verifies read/write policies and limits application-only routes. The guard tests cover cross-domain, method, user and application boundaries.
Swagger scope documentation
Regenerate the OpenAPI specification with php bin/generate_swagger, or run it through the appropriate Docker host profile. Api\OpenApi\ListenerScopes reads each operation's listener and HTTP method and uses the same $scopes metadata as the central guard. It generates OAuth2 security requirements and visible scope descriptions, and populates the available scope catalogue from ApiScope. Separate security requirements mean alternatives: an endpoint accepting Action.Read.Own or Action.Read.All does not require both.
Swagger supports the local authorization-code flow through /oauth/authorize and /oauth. The existing bearerAuth option also accepts a pasted access token, including one obtained through Entra. The same scope and user restrictions apply to both options. The generator fails if a documented listener operation has no scope policy for its HTTP method.