Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/book-audience-permission-set.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@object-ui/app-shell': minor
---

Book audience mirrors the spec's permission-set gate (ADR-0090).

`@objectstack/spec` renamed the gated arm of `BookAudience` from
`{ profile: string }` to `{ permissionSet: string }` — ADR-0090 D2 removed
the Profile concept, and D9 makes the gate a capability reference (a
permission-set name the reader must hold, e.g. `crm_admin`). Updated the
three mirrors: the metadata-admin default JSON schema (`book.audience`
`oneOf`), the `BookPreview` audience chip, and the book list-column
renderer. One-step rename, no alias, matching the spec's launch-window
discipline.
4 changes: 2 additions & 2 deletions packages/app-shell/src/services/builtinComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ registerMetadataResource({
render: (v) =>
v == null
? 'org'
: typeof v === 'object' && v && 'profile' in (v as Record<string, unknown>)
? `profile: ${(v as { profile: string }).profile}`
: typeof v === 'object' && v && 'permissionSet' in (v as Record<string, unknown>)
? `permission set: ${(v as { permissionSet: string }).permissionSet}`
: String(v),
},
{
Expand Down
14 changes: 10 additions & 4 deletions packages/app-shell/src/views/metadata-admin/default-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,18 @@ const SCHEMAS: Record<string, Record<string, unknown>> = {
},
audience: {
title: 'Audience',
description: "Access audience. 'org' (default) inherits the package grant; 'public' is anonymously readable; { profile } gates by role.",
// Union of the two scalar literals and the { profile } object — kept lax
// so the role-gated object form round-trips untouched through the form.
description:
"Access audience. 'org' (default) inherits the package grant; 'public' is anonymously readable; { permissionSet } gates by a permission set the reader must hold (ADR-0090).",
// Union of the two scalar literals and the { permissionSet } object — kept lax
// so the permission-set-gated object form round-trips untouched through the form.
oneOf: [
{ type: 'string', enum: ['org', 'public'] },
{ type: 'object', title: 'Role-gated', properties: { profile: { type: 'string', title: 'Profile' } }, required: ['profile'] },
{
type: 'object',
title: 'Permission-set gated',
properties: { permissionSet: { type: 'string', title: 'Permission set' } },
required: ['permissionSet'],
},
],
},
groups: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
import type { MetadataPreviewProps } from '../preview-registry';
import { PreviewShell, PreviewErrorBoundary, PreviewEmptyState } from './PreviewShell';

type Audience = 'org' | 'public' | { profile: string } | undefined;
type Audience = 'org' | 'public' | { permissionSet: string } | undefined;
type Include = string | { tag: string } | undefined;

interface PageNode {
Expand Down Expand Up @@ -116,8 +116,8 @@ function audienceChip(audience: Audience): { icon: React.ReactNode; label: strin
if (audience === 'public') {
return { icon: <Globe className="h-3 w-3" />, label: 'Public', tone: 'text-emerald-700 bg-emerald-50 border-emerald-200' };
}
if (audience && typeof audience === 'object' && typeof audience.profile === 'string') {
return { icon: <Lock className="h-3 w-3" />, label: `Profile: ${audience.profile}`, tone: 'text-amber-800 bg-amber-50 border-amber-200' };
if (audience && typeof audience === 'object' && typeof audience.permissionSet === 'string') {
return { icon: <Lock className="h-3 w-3" />, label: `Permission set: ${audience.permissionSet}`, tone: 'text-amber-800 bg-amber-50 border-amber-200' };
}
// 'org' (default) or absent — inherits the package grant.
return { icon: <Building2 className="h-3 w-3" />, label: 'Org', tone: 'text-muted-foreground bg-muted/40 border-muted' };
Expand Down
Loading