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
20 changes: 20 additions & 0 deletions .changeset/34908-view-audience-picker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'@objectstack/spec': patch
'@objectstack/platform-objects': patch
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(app-shell): 「Who sees this view」 — pick a shared view's or a dashboard's audience from the known capabilities, and see which positions will see it

Clause-②: no
Metadata-protocol: none

The audience gate is the existing, server-enforced `requiredPermissions` (all of the capabilities listed are required). The console now sets it from a closed list and shows who it reaches; no key, value or gate changes, and nothing is granted from the view (granting stays in Setup).

- **`@object-ui/app-shell`.** The view switcher's in-place create card offers 「Who sees this view」 for a shared view: the capabilities the environment knows (declared, or granted by a permission set), each with the permission sets granting it, and a read-only preview of the positions whose permission sets grant every capability picked. The preview reads each position's sets from the server (`GET /meta/position?include=grants`, the sets the resolver grants its holders), never from a position's raw definition; a list served without them leaves the positions unknown. While a gate is picked, the card says it applies to its creator too. It starts from the open view's gate, which a new shared view used to inherit silently, and the pick replaces it; an empty pick writes no gate. A failed catalog read offers nothing to type. The shared hint no longer says every shared view is seen by everyone who can see the list. In Studio, the view panel's and the dashboard settings' audience row is the new `ref-multi:capability` picker: a closed list (no typed-name box when the catalog is unread, empty or failed), each option with its granting sets, and the same preview under it. The picker reads the catalog once its row is on screen, so an editor whose audience section stays closed sends no request.
- **`@objectstack/spec`.** The view and dashboard forms' `requiredPermissions` rows declare `widget: 'ref-multi:capability'` (the list is closed: a host with no catalog offers nothing to add). The view hint's last sentence now says only what holds on every carrier: the person setting the gate no longer sees the view in the list either.
- **`@objectstack/platform-objects`.** The `metadataForms` bundles carry the narrowed view hint (zh-CN, ja-JP and es-ES translated; the other locales the English source).
- **`@object-ui/i18n`.** The create card's new strings and the corrected shared hint, in all eleven console locales.

Nothing to migrate.
44 changes: 44 additions & 0 deletions content/docs/permissions/capabilities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,49 @@ the same way; a user who may edit the object still reads all of its list views,
so a save of what they loaded keeps them.
</Callout>

## Showing a list view to some positions, without code

An administrator can decide who sees a shared list view or a dashboard in the
console, with no source file. The gate is the same `requiredPermissions` as
above, and the console only sets it; it grants nothing. Granting stays in
Setup.

1. **Have a capability for the audience.** Use one your app declares, or
declare one in the environment
([below](#declaring-a-capability-in-the-environment)). One capability per
audience, for example `crm_deal.view_sales` for "the sales team's deal
view".
2. **Grant it in Setup.** Add the name to the `systemPermissions` of a
permission set, and give that set to the positions that should see the
view. A position carries no capability of its own: it passes on what its
permission sets grant. To show the view to two groups, grant the one
capability to both groups' sets.
3. **Pick it on the view.** In the view switcher, **Add view → Shared** offers
**Who sees this view**. For an existing view, Studio's view panel has
**Required permissions** under **Navigation & sharing**, and a dashboard's
settings have it under **Access**. Both list only the capabilities the
environment knows, that is the ones declared and the ones a permission set
grants, with the sets granting each. You cannot type a name that matches
nothing there.

Under the pick, the console previews the positions that will see the view: the
positions whose permission sets grant **every** capability picked. It reads
which sets each position grants from the server, the sets the resolver grants
its holders, so a position that has been switched off reaches no one. The preview is
still advice, and the server stays the authority: it cannot name people who
hold a set directly rather than through a position, nor people who hold the
picked capabilities between several positions. A person holds everything each
of their positions grants, so two positions that each grant part of the pick
let their joint holders through.

<Callout type="warn">
**The gate applies to you too.** Pick a capability you do not hold, and the view
leaves your own view switcher as well. A view or a dashboard saved on its own
is then refused to you on every door, Studio included, until someone grants
you the capability. Grant it to your own permission set first if you still need
to open the view.
</Callout>

## One holder per name

Each capability name has exactly one holder in the registry. When a package
Expand Down Expand Up @@ -303,6 +346,7 @@ copy and the two would share one gate. Prefix your capability names.
- [ ] The declaration is reachable from the stack (`capabilities: [...]`) or a `*.capability.ts` file
- [ ] No other installed package declares the same name — the registry refuses a second holder at boot
- [ ] Something actually **requires** the name (`requiredPermissions`), and something **grants** it (`systemPermissions`)
- [ ] A list view or dashboard gated from the console: its capability is granted to the positions' permission sets, and to your own if you still need to open it

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export const arMetadataForms: NonNullable<TranslationData['metadataForms']> = {
},
requiredPermissions: {
label: "Required Permissions",
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you can no longer open this view either."
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you no longer see this view in the list either."
},
object: {
label: "الكائن"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const arGeneratedSourceHashes: Readonly<Record<string, string>> = {
"metadataForms.report.fields.exportOptions.formats.label": "193cd91818d64ef7",
"metadataForms.report.fields.exportOptions.includeHeaders.helpText": "44cbc80015ff051d",
"metadataForms.report.fields.exportOptions.includeHeaders.label": "f114a4778c9727ae",
"metadataForms.view.fields.requiredPermissions.helpText": "c4599be2ffa06c02",
"metadataForms.view.fields.requiredPermissions.helpText": "824ea3479e2e607a",
"metadataForms.view.fields.requiredPermissions.label": "a47b2168b71f5e68",
"objects.sys_email.fields.message_id.label": "14cd089a4062f4b1",
"objects.sys_email_template.fields.package_id.help": "e1f8cc4d0105cedc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export const deMetadataForms: NonNullable<TranslationData['metadataForms']> = {
},
requiredPermissions: {
label: "Required Permissions",
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you can no longer open this view either."
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you no longer see this view in the list either."
},
object: {
label: "Objekt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const deGeneratedSourceHashes: Readonly<Record<string, string>> = {
"metadataForms.view.fields.kanban.label": "dd95c452aa71459e",
"metadataForms.view.fields.name.label": "5274417ff1ccaf01",
"metadataForms.view.fields.navigation.label": "51cd9fc784a9643f",
"metadataForms.view.fields.requiredPermissions.helpText": "c4599be2ffa06c02",
"metadataForms.view.fields.requiredPermissions.helpText": "824ea3479e2e607a",
"metadataForms.view.fields.requiredPermissions.label": "a47b2168b71f5e68",
"metadataForms.view.fields.userActions.filter.label": "802895ec427fc6af",
"metadataForms.view.fields.userFilters.element.label": "e480e4fe57239c98",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
},
requiredPermissions: {
label: "Required Permissions",
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you can no longer open this view either."
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you no longer see this view in the list either."
},
object: {
label: "Object"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export const esESMetadataForms: NonNullable<TranslationData['metadataForms']> =
},
requiredPermissions: {
label: "Permisos requeridos",
helpText: "Quién ve esta vista: las capacidades que una persona debe tener, todas las indicadas. Los conjuntos de permisos otorgan capacidades, y un puesto transmite las que otorgan sus conjuntos de permisos. Si se deja vacío, todos los que pueden ver la lista ven esta vista. Para mostrarla a varios grupos, elija una capacidad y otórguela al conjunto de permisos de cada grupo. El servidor lo aplica: los demás no encuentran la vista en la lista y se les deniega si la abren directamente. Esto también se aplica a usted: si indica una capacidad que no tiene, o la escribe mal, usted tampoco podrá volver a abrir esta vista."
helpText: "Quién ve esta vista: las capacidades que una persona debe tener, todas las indicadas. Los conjuntos de permisos otorgan capacidades, y un puesto transmite las que otorgan sus conjuntos de permisos. Si se deja vacío, todos los que pueden ver la lista ven esta vista. Para mostrarla a varios grupos, elija una capacidad y otórguela al conjunto de permisos de cada grupo. El servidor lo aplica: los demás no encuentran la vista en la lista y se les deniega si la abren directamente. Esto también se aplica a usted: si indica una capacidad que no tiene, o la escribe mal, usted tampoco verá esta vista en la lista."
},
object: {
label: "Objeto"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export const frMetadataForms: NonNullable<TranslationData['metadataForms']> = {
},
requiredPermissions: {
label: "Required Permissions",
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you can no longer open this view either."
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you no longer see this view in the list either."
},
object: {
label: "Objet"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const frGeneratedSourceHashes: Readonly<Record<string, string>> = {
"metadataForms.view.fields.navigation.label": "51cd9fc784a9643f",
"metadataForms.view.fields.navigation.mode.label": "74dde5013435abdc",
"metadataForms.view.fields.pagination.label": "309131fbaca258df",
"metadataForms.view.fields.requiredPermissions.helpText": "c4599be2ffa06c02",
"metadataForms.view.fields.requiredPermissions.helpText": "824ea3479e2e607a",
"metadataForms.view.fields.requiredPermissions.label": "a47b2168b71f5e68",
"metadataForms.view.fields.selection.type.label": "901bb552898b2cab",
"metadataForms.view.fields.type.label": "901bb552898b2cab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export const jaJPMetadataForms: NonNullable<TranslationData['metadataForms']> =
},
requiredPermissions: {
label: "必要な権限",
helpText: "このビューを見られる人:閲覧者が保持する必要のあるケイパビリティで、列挙したものはすべて必要です。ケイパビリティは権限セットが付与し、ポジションはその権限セットが付与するものを引き継ぎます。空にすると、リストを見られる全員がこのビューを見られます。複数のグループに見せるには、ケイパビリティを 1 つ選び、各グループの権限セットに付与してください。サーバーが強制します:それ以外の人にはリストにこのビューが表示されず、直接開いても拒否されます。これはあなた自身にも適用されます:保持していないケイパビリティや綴りを誤ったケイパビリティを指定すると、あなたもこのビューを開けなくなります。"
helpText: "このビューを見られる人:閲覧者が保持する必要のあるケイパビリティで、列挙したものはすべて必要です。ケイパビリティは権限セットが付与し、ポジションはその権限セットが付与するものを引き継ぎます。空にすると、リストを見られる全員がこのビューを見られます。複数のグループに見せるには、ケイパビリティを 1 つ選び、各グループの権限セットに付与してください。サーバーが強制します:それ以外の人にはリストにこのビューが表示されず、直接開いても拒否されます。これはあなた自身にも適用されます:保持していないケイパビリティや綴りを誤ったケイパビリティを指定すると、あなたのリストにもこのビューは表示されなくなります。"
},
object: {
label: "オブジェクト"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export const koMetadataForms: NonNullable<TranslationData['metadataForms']> = {
},
requiredPermissions: {
label: "Required Permissions",
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you can no longer open this view either."
helpText: "Who sees this view: the capabilities a person must hold, every one listed. Permission sets grant capabilities, and a position passes on the ones its permission sets grant. Leave it empty and everyone who can see the list sees this view. To show it to several groups, pick one capability and grant it to each group's permission set. The server enforces it: anyone else does not find the view in the list and is refused if they open it directly. The gate applies to you too: list a capability you do not hold, or misspell one, and you no longer see this view in the list either."
},
object: {
label: "객체"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const koGeneratedSourceHashes: Readonly<Record<string, string>> = {
"metadataForms.report.fields.exportOptions.formats.label": "193cd91818d64ef7",
"metadataForms.report.fields.exportOptions.includeHeaders.helpText": "44cbc80015ff051d",
"metadataForms.report.fields.exportOptions.includeHeaders.label": "f114a4778c9727ae",
"metadataForms.view.fields.requiredPermissions.helpText": "c4599be2ffa06c02",
"metadataForms.view.fields.requiredPermissions.helpText": "824ea3479e2e607a",
"metadataForms.view.fields.requiredPermissions.label": "a47b2168b71f5e68",
"objects.sys_email.fields.message_id.label": "14cd089a4062f4b1",
"objects.sys_email_template.fields.id.label": "00b0385c9c152888",
Expand Down
Loading
Loading