docs: document UI role gating for VIEWER/OPERATOR/ADMIN
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,7 @@ java -jar cameleer3-server-app/target/cameleer3-server-app-1.0-SNAPSHOT.jar
|
||||
- Multi-tenancy: each server instance serves one tenant (configured via `CAMELEER_TENANT_ID`, default: `"default"`). Environments (dev/staging/prod) are first-class — agents send `environmentId` at registration and in heartbeats. JWT carries `env` claim for environment persistence across token refresh. PostgreSQL isolated via schema-per-tenant (`?currentSchema=tenant_{id}`). ClickHouse shared DB with `tenant_id` + `environment` columns, partitioned by `(tenant_id, toYYYYMM(timestamp))`.
|
||||
- Storage: PostgreSQL for RBAC, config, and audit; ClickHouse for all observability data (executions, search, logs, metrics, stats, diagrams). ClickHouse schema migrations in `clickhouse/*.sql`, run idempotently on startup by `ClickHouseSchemaInitializer`. Use `IF NOT EXISTS` for CREATE and ADD PROJECTION.
|
||||
- Logging: ClickHouse JDBC set to INFO (`com.clickhouse`), HTTP client to WARN (`org.apache.hc.client5`) in application.yml
|
||||
- Security: JWT auth with RBAC (AGENT/VIEWER/OPERATOR/ADMIN roles), Ed25519 config signing (key derived deterministically from JWT secret via HMAC-SHA256), bootstrap token for registration. CORS: `CAMELEER_CORS_ALLOWED_ORIGINS` (comma-separated) overrides `CAMELEER_UI_ORIGIN` for multi-origin setups (e.g., reverse proxy).
|
||||
- Security: JWT auth with RBAC (AGENT/VIEWER/OPERATOR/ADMIN roles), Ed25519 config signing (key derived deterministically from JWT secret via HMAC-SHA256), bootstrap token for registration. CORS: `CAMELEER_CORS_ALLOWED_ORIGINS` (comma-separated) overrides `CAMELEER_UI_ORIGIN` for multi-origin setups (e.g., reverse proxy). UI role gating: Admin sidebar/routes hidden for non-ADMIN; diagram toolbar and route control hidden for VIEWER; App Config is a per-app main tab (read-only for VIEWER, editable for OPERATOR+). Role helpers: `useIsAdmin()`, `useCanControl()` in `auth-store.ts`. Route guard: `RequireAdmin` in `auth/RequireAdmin.tsx`.
|
||||
- OIDC: Optional external identity provider support (token exchange pattern). Configured via admin API/UI, stored in database (`server_config` table). Configurable `userIdClaim` (default `sub`) determines which id_token claim is used as the user identifier. Resource server mode: accepts external access tokens (Logto M2M) via JWKS validation when `CAMELEER_OIDC_ISSUER_URI` is set. `CAMELEER_OIDC_JWK_SET_URI` overrides JWKS discovery for container networking. `CAMELEER_OIDC_TLS_SKIP_VERIFY=true` disables TLS cert verification for OIDC calls (self-signed CAs). Scope-based role mapping (case-insensitive): `admin`/`server:admin` → ADMIN, `operator`/`server:operator` → OPERATOR, `viewer`/`server:viewer` → VIEWER. SSO: when OIDC enabled, UI auto-redirects to provider with `prompt=none` for silent sign-in; falls back to `/login?local` on `login_required`, retries without `prompt=none` on `consent_required`. Auto-signup provisions new OIDC users with default roles. System roles synced on every OIDC login (revocations propagate on next login); group memberships are never touched. Supports ES384, ES256, RS256.
|
||||
- User persistence: PostgreSQL `users` table, admin CRUD at `/api/v1/admin/users`
|
||||
- Usage analytics: ClickHouse `usage_events` table tracks authenticated UI requests, flushed every 5s
|
||||
|
||||
8
HOWTO.md
8
HOWTO.md
@@ -100,12 +100,14 @@ JWTs carry a `roles` claim. Endpoints are restricted by role:
|
||||
| Role | Access |
|
||||
|------|--------|
|
||||
| `AGENT` | Data ingestion (`/data/**` — executions, diagrams, metrics, logs), heartbeat, SSE events, command ack |
|
||||
| `VIEWER` | Search, execution detail, diagrams, agent list |
|
||||
| `OPERATOR` | VIEWER + send commands to agents |
|
||||
| `ADMIN` | OPERATOR + user management (`/admin/**`) |
|
||||
| `VIEWER` | Search, execution detail, diagrams, agent list, app config (read-only) |
|
||||
| `OPERATOR` | VIEWER + send commands to agents, route control, replay, edit app config |
|
||||
| `ADMIN` | OPERATOR + user management, audit log, OIDC config, database admin (`/admin/**`) |
|
||||
|
||||
The env-var local user gets `ADMIN` role. Agents get `AGENT` role at registration.
|
||||
|
||||
**UI role gating:** The sidebar hides the Admin section for non-ADMIN users. Admin routes (`/admin/*`) redirect to `/` for non-admin. The diagram node toolbar and route control bar are hidden for VIEWER. App Config is a main tab (per-app, visible when an app is selected) — VIEWER sees read-only, OPERATOR+ can edit.
|
||||
|
||||
### OIDC Login (Optional)
|
||||
|
||||
OIDC configuration is stored in PostgreSQL and managed via the admin API or UI. The SPA checks if OIDC is available:
|
||||
|
||||
@@ -250,6 +250,19 @@ Config fields: `metricsEnabled`, `samplingRate`, `tracedProcessors`, `logLevels`
|
||||
| `OPERATOR` | VIEWER + send commands, modify config, replay |
|
||||
| `ADMIN` | OPERATOR + user/group/role management, OIDC config, database admin |
|
||||
|
||||
### UI Role Gating
|
||||
|
||||
The UI enforces role-based visibility (backend ACLs remain the authoritative check):
|
||||
|
||||
| UI element | VIEWER | OPERATOR | ADMIN |
|
||||
|-----------|--------|----------|-------|
|
||||
| Exchanges, Dashboard, Runtime, Logs | Yes | Yes | Yes |
|
||||
| Config tab (per-app) | Read-only | Edit | Edit |
|
||||
| Route control bar | Hidden | Yes | Yes |
|
||||
| Diagram node toolbar | Hidden | Yes | Yes |
|
||||
| Admin sidebar section | Hidden | Hidden | Yes |
|
||||
| Admin pages (`/admin/*`) | Redirect to `/` | Redirect to `/` | Yes |
|
||||
|
||||
### Ed25519 Config Signing
|
||||
|
||||
Server derives an Ed25519 keypair deterministically from the JWT secret. Public key is shared with agents at registration. Config-update payloads are signed so agents can verify authenticity.
|
||||
|
||||
Reference in New Issue
Block a user