Eval User
Eval User protocol schemas
EvalUser — the one user-context contract (ADR-0068 D1).
The signed-in user exposed to every predicate surface (server formula, server
RLS, client UI gates) under the canonical variable name current_user
(aliases user, ctx.user) with an identical shape. A predicate such as
current_user.positions.exists(p, p == 'org_admin') (or
'org_admin' in current_user.positions) therefore evaluates identically wherever
it is written.
positions: string[] is the only canonical membership field (renamed from
roles, ADR-0090 D3). A singular field is NOT part of this contract — its legacy "overwritten to 'admin' on promotion"
behavior is the footgun this eliminates.
@see docs/adr/0068-unified-user-context-and-built-in-identity-roles.md
Source: packages/spec/src/identity/eval-user.zod.ts
TypeScript Usage
import { EvalUser } from '@objectstack/spec/identity';
import type { EvalUser } from '@objectstack/spec/identity';
// Validate data
const result = EvalUser.parse(data);EvalUser
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | ✅ | User ID |
| name | string | optional | Display name |
string | optional | Email address | |
| positions | string[] | ✅ | Canonical position/identity names assigned to the user (scope-resolved) |
| isPlatformAdmin | boolean | optional | DERIVED alias of 'platform_admin' in positions. Deprecated. |
| organizationId | string | null | optional | Active organization ID (null = platform/unscoped) |