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
19 changes: 19 additions & 0 deletions .changeset/39439-setup-knowledge-and-delivery-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@objectstack/platform-objects': patch
'@objectstack/service-messaging': patch
'@objectstack/service-settings': patch
---

fix(setup): Setup → Knowledge says where the rest of a knowledge setup lives, Delivery Log shows who each notification went to, by which channel, and whether it was delivered, and the notification event list keeps its own Setup entry, Notification Events, served to organization administrators

Clause-②: yes (widening)
Metadata-protocol: none

The widening: a Setup entry, Notification Events, is served to callers who hold `setup.write` and were served no entry for that list before (organization administrators hold `setup.write` and not `manage_platform_settings`).

Who sees it: a platform administrator in Setup; an organization administrator sees Notification Events.

- **Setup → Knowledge** no longer calls itself the vector-store backend. It holds the indexing defaults, and its description now names the two other places a knowledge base is set up: the embedding provider, under AI Model Service → Embedder (a saved provider takes effect after a server restart), and the knowledge sources themselves, created in App Studio → AI. The sentence is in every shipped language, with each page named the way that language names it. It is plain text, not a link.
- **Setup → Notifications → Delivery Log** now opens the delivery list (`sys_notification_delivery`, new `recent` view) instead of the notification event list. Each row is one send: the recipient (the person, and the address it went to), the channel, the status (pending, in flight, success, dead, suppressed), the attempts, the last error, the topic and when it was queued, newest first. The entry keeps its name, its place and its gate (`manage_platform_settings`), and it is shown only where the messaging service is mounted. The event list (`sys_notification`) is no longer opened from this entry; the search alias "Notification Events" moves to the event list's own entry below.
- **Setup → Notifications → Notification Events** is a new entry, after Delivery Log, opening the notification event list (`sys_notification`, view `recent`), whose toolbar carries **Send In-App Message**. It is gated on `setup.write`, the capability that action and its door demand, so organization administrators, who hold `setup.write` and are deliberately withheld `manage_platform_settings`, now reach the action from the menu; before, the list's only Setup entry was gated on `manage_platform_settings`. Who reads the rows is still the object grant's call, and who may send is still judged by the door. The label is in every shipped language. The administrator guide now names this path for sending a message to the organization.
- The topic still shows as its key (for example `approval.requested`): the platform has no display names for notification topics.
12 changes: 7 additions & 5 deletions content/docs/permissions/administrator-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Full model: [Permission Sets](/docs/permissions/permission-sets).
## Send a message to your organization

To tell people something in the app (a maintenance window, a policy change),
open **Setup → Notifications → Delivery Log** and choose **Send In-App
open **Setup → Notifications → Notification Events** and choose **Send In-App
Message**. The message lands in each recipient's notifications, the bell,
like any other notification.

Expand All @@ -245,7 +245,9 @@ like any other notification.

When it is sent, the confirmation says how many people it went to. Each
message is a notification event with the topic `org.announcement`, listed on
the same page. A member whose notification preferences turn that topic off
the same page. Who each event reached, by which channel and whether it
arrived, is in **Setup → Notifications → Delivery Log**, which is shown to
holders of `manage_platform_settings` (platform administrators). A member whose notification preferences turn that topic off
is not sent it, and is not counted. The count is of the people a delivery
was accepted for. A send that reached nobody is refused instead of
confirmed: `409` when every person you picked has turned the topic off, and
Expand Down Expand Up @@ -296,7 +298,7 @@ the notification settings page lists no Slack channel.
| Someone changed departments | Update their Business Unit Member row; re-anchor their User Position rows |
| Let a subsidiary manage its own staff | Grant a set carrying a [delegated admin scope](/docs/permissions/delegated-administration) |
| Give one user one extra capability | Permission set record → **Assigned Users** → add (direct grant) |
| Tell everyone in the organization something | Setup → Notifications → Delivery Log → **Send In-App Message** ([above](#send-a-message-to-your-organization)) |
| Tell everyone in the organization something | Setup → Notifications → Notification Events → **Send In-App Message** ([above](#send-a-message-to-your-organization)) |

## FAQ

Expand Down Expand Up @@ -328,8 +330,8 @@ sets can't be edited in place either, but they can be cloned and adjusted
| Sharing rules, record shares | Setup → Access & Sharing → Sharing Rules / Record Shares |
| Password policy, MFA, lockout, SSO | Setup → Login & Security → Sign-in Methods / SSO Providers |
| Company info, localization, branding | Setup → Users & Organization → Company Information; Setup → Company Settings → Language & Region / Branding |
| Sessions, notification events, audit logs | Setup → Login & Security → Active Sessions; Setup → Notifications → Delivery Log; Setup → Audit & Data → Audit Log |
| Send an in-app message to the organization | Setup → Notifications → Delivery Log |
| Sessions, notification events, notification deliveries, audit logs | Setup → Login & Security → Active Sessions; Setup → Notifications → Notification Events / Delivery Log; Setup → Audit & Data → Audit Log |
| Send an in-app message to the organization | Setup → Notifications → Notification Events |
| Explain access | Studio → Access |

---
Expand Down
67 changes: 66 additions & 1 deletion packages/cli/test/setup-diagnostics-audience.pin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ import { describe, expect, it, vi } from 'vitest';
import { SchemaRegistry } from '@objectstack/objectql';
import { SETUP_APP, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps';
import { AuditPlugin } from '@objectstack/plugin-audit';
import { securityDefaultPermissionSets } from '@objectstack/plugin-security';
import { RestServer } from '@objectstack/rest';
import { ADMIN_FULL_ACCESS_CAPABILITIES } from '@objectstack/spec';
import { ADMIN_FULL_ACCESS_CAPABILITIES, ORGANIZATION_ADMIN } from '@objectstack/spec';

type AnyRec = Record<string, any>;

Expand Down Expand Up @@ -190,3 +191,67 @@ describe('Setup → Diagnostics: each entry is served to the holders of its own
expect(diagnostics(admin)?.[0]).toBe('nav_audit_logs');
});
});

// ---------------------------------------------------------------------------
// Setup → Notifications → Notification Events, served to the audience of the
// action it carries (#39439)
// ---------------------------------------------------------------------------
// The event list (`sys_notification`) carries Send In-App Message, the Setup
// action ruled for organization administrators (ruling 6810324463 on #32445),
// gated on `setup.write`. Delivery Log now opens the delivery list, so the
// event list has its own entry, `nav_notification_events`, gated on that same
// `setup.write`. Read over the wire, per caller:
//
// - the shipped organization-administrator set, and nothing else → served
// Notification Events in Notifications, and not Delivery Log (that one
// keeps `manage_platform_settings`, which the set deliberately withholds);
// - `setup.access` without `setup.write` → not served it, anywhere in Setup;
// - the platform administrator → both, Notification Events after Delivery Log.
//
// The organization administrator's permissions are read off the set the
// security plugin ships, never retyped here, so a change to that set is
// judged by this pin.

const NOTIFICATIONS = 'group_notifications';

/** The served children of Notifications by id, or `undefined` when the group is not served. */
function notifications(app: AnyRec): string[] | undefined {
const found = ((app?.navigation ?? []) as AnyRec[]).find((g) => g?.id === NOTIFICATIONS);
return found ? ((found.children ?? []) as AnyRec[]).map((c) => String(c?.id)) : undefined;
}

/** The system permissions of the shipped organization-administrator set. */
function organizationAdminPermissions(): string[] {
const set = securityDefaultPermissionSets.find((s) => s.name === ORGANIZATION_ADMIN);
if (!set) throw new Error(`the security plugin ships no ${ORGANIZATION_ADMIN} set`);
return [...(set.systemPermissions ?? [])];
}

describe('Setup → Notifications → Notification Events: served to the holders of setup.write', () => {
it('a caller holding only the shipped organization-administrator set is served Notification Events, and not Delivery Log', async () => {
const permissions = organizationAdminPermissions();
// Control: the set holds the action's capability and is denied platform
// settings, so the two answers below are the two gates.
expect(permissions).toContain('setup.write');
expect(permissions).not.toContain('manage_platform_settings');
const setup = await servedSetup(permissions);
expect(notifications(setup)).toContain('nav_notification_events');
expect(allIds(setup.navigation)).not.toContain('nav_notifications');
const entry = ((setup.navigation as AnyRec[]).find((g) => g?.id === NOTIFICATIONS)?.children as AnyRec[])
.find((c) => c?.id === 'nav_notification_events');
expect(entry).toMatchObject({ type: 'object', objectName: 'sys_notification', viewName: 'recent' });
});

it('a caller without setup.write is not served Notification Events, anywhere in Setup', async () => {
const reader = await servedSetup(['setup.access']);
expect(allIds(reader.navigation)).not.toContain('nav_notification_events');
// Control: the app itself is served to this member.
expect(allIds(reader.navigation).length).toBeGreaterThan(0);
});

it('the platform administrator is served Delivery Log, then Notification Events', async () => {
const admin = await servedSetup(ADMIN_FULL_ACCESS_CAPABILITIES.systemPermissions ?? []);
const ids = notifications(admin) ?? [];
expect(ids.slice(-2)).toEqual(['nav_notifications', 'nav_notification_events']);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ describe('the population is derived from Setup and Account navigation (#21972)',

it('cannot read exactly these named objects from this package', () => {
// `sys_inbox_message` is `@objectstack/service-messaging`'s; the Account
// app's Notifications entry names it, and names `mine`.
expect(UNRESOLVED).toEqual(['sys_inbox_message']);
// app's Notifications entry names it, and names `mine`. So is
// `sys_notification_delivery`, which Setup's Delivery Log names with its
// `recent` view (#39439), a view that is not caller-scoped.
expect(UNRESOLVED).toEqual(['sys_inbox_message', 'sys_notification_delivery']);
});

it('finds exactly these named objects declaring only caller-scoped list views', () => {
Expand Down
31 changes: 25 additions & 6 deletions packages/platform-objects/src/apps/setup-nav.contributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* group_currency_units 100
* group_notifications 200: Email / SMS Channel, after Notification
* Templates; 201–399 Notification Preferences;
* 400: Delivery Log
* 400: Delivery Log, then Notification Events
* group_login_security 100
* group_integrations_dev 100: API Keys, OAuth Applications; 101–499 the
* plugins' integrations; 500: Public Forms last
Expand Down Expand Up @@ -274,11 +274,30 @@ export const SETUP_NAV_CONTRIBUTIONS: NavigationContribution[] = [
// Last in the group, after Notification Preferences.
priority: 400,
items: [
// What was sent, to whom and whether it arrived (`sys_notification`'s
// `recent` list). Gated on `manage_platform_settings`, the gate the
// retired Diagnostics group gave it, so it is served to exactly the
// members it was before.
{ id: 'nav_notifications', type: 'object', label: 'Delivery Log', objectName: 'sys_notification', viewName: 'recent', icon: 'bell', requiresObject: 'sys_notification', requiredPermissions: ['manage_platform_settings'], keywords: ['Notification Events', 'Notifications'] },
// What was sent, to whom and whether it arrived: the delivery outbox's
// `recent` list, one row per recipient and channel with its status
// (`sys_notification_delivery`, `@objectstack/service-messaging`). It
// opened the notification EVENT list (`sys_notification`) before, which
// carries no recipient, channel or outcome (#39439 item 5).
// `requiresObject` hides the entry where the messaging service, which
// registers the object, is not mounted. Gated on
// `manage_platform_settings`, the gate the retired Diagnostics group gave
// it, so it is served to exactly the members it was before.
{ id: 'nav_notifications', type: 'object', label: 'Delivery Log', objectName: 'sys_notification_delivery', viewName: 'recent', icon: 'bell', requiresObject: 'sys_notification_delivery', requiredPermissions: ['manage_platform_settings'], keywords: ['Notifications'] },
// What was emitted: the notification EVENT list (`sys_notification`'s
// `recent` list, one row per `emit()`), and the list whose toolbar
// carries Send In-App Message, the Setup action an organization
// administrator sends an in-app message with (ruling 6810324463 on
// #32445; #39439). Delivery Log above answers who each event reached.
// Gated on `setup.write`, the capability that action and its door
// demand, so the entry is served to exactly the audience the action is
// for: organization administrators and the platform administrator.
// `manage_platform_settings` would withhold it from the organization
// administrator, who holds `setup.write` and is deliberately denied
// platform settings. Who reads the rows stays the object grant's call;
// who sends stays the door's. `requiresObject` hides the entry where the
// messaging service, which registers the object, is not mounted.
{ id: 'nav_notification_events', type: 'object', label: 'Notification Events', objectName: 'sys_notification', viewName: 'recent', icon: 'bell-ring', requiresObject: 'sys_notification', requiredPermissions: ['setup.write'] },
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ const platformItem = (id: string): NavItem | undefined =>
// contributes, in the table's order. Users & Organization ends with the
// active organization's page (`nav_organization`, 当前组织), which the table
// does not list: it stays in the group it was in, after the listed entries.
// Notifications ends with the notification event list (`nav_notification_events`,
// 通知事件), which the table does not list either: the plan keeps every page
// as its own entry, and once Delivery Log opened the delivery list (#39439)
// the event list, with its Send In-App Message action, needed its own.
const TABLE: ReadonlyArray<readonly [string, readonly string[], readonly string[]]> = [
['group_users_org', ['nav_settings_company', 'nav_users', 'nav_invitations', 'nav_teams', 'nav_business_units', 'nav_organizations', 'nav_organization'], ['公司信息', '用户', '邀请', '团队', '业务单元', '所有组织', '当前组织']],
['group_access_sharing', ['nav_access_directory'], ['岗位与权限']],
Expand All @@ -96,7 +100,7 @@ const TABLE: ReadonlyArray<readonly [string, readonly string[], readonly string[
['group_audit_data', ['nav_recycle_bin', 'nav_settings_lifecycle', 'nav_settings_storage'], ['回收站', '数据保留', '文件存储']],
['group_company', ['nav_settings_localization', 'nav_work_calendars', 'nav_work_calendar_exceptions'], ['语言与区域', '工作日历', '节假日与调休']],
['group_currency_units', ['nav_exchange_rates', 'nav_units_of_measure', 'nav_standard_unit_settings'], ['汇率', '计量单位', '标准单位小数位']],
['group_notifications', ['nav_settings_mail', 'nav_settings_sms', 'nav_notifications'], ['邮件通道', '短信通道', '发送记录']],
['group_notifications', ['nav_settings_mail', 'nav_settings_sms', 'nav_notifications', 'nav_notification_events'], ['邮件通道', '短信通道', '发送记录', '通知事件']],
['group_login_security', ['nav_settings_auth', 'nav_settings_access_policy', 'nav_sessions'], ['登录方式', '访问策略', '在线会话']],
['group_integrations_dev', ['nav_api_keys', 'nav_oauth_apps', 'nav_public_forms'], ['API 密钥', 'OAuth 应用', '对外表单']],
];
Expand Down Expand Up @@ -174,8 +178,10 @@ const SOURCE_KEYWORDS: Record<string, string[]> = {
nav_settings_ai: ['AI & Embedder'],
nav_settings_lifecycle: ['Data Lifecycle'],
// The literal said "Notification Events" while the English bundle served
// "Notifications": both were names an administrator read.
nav_notifications: ['Notification Events', 'Notifications'],
// "Notifications": both were names an administrator read. "Notification
// Events" is the name of the event list's own entry now (#39439), so a
// search for it finds that entry, not the Delivery Log.
nav_notifications: ['Notifications'],
nav_sessions: ['Sessions'],
};

Expand Down Expand Up @@ -234,6 +240,7 @@ describe('Setup platform-owned entries: groups, order, names and aliases (#39057
// between them and the Delivery Log.
expect(priorities('group_notifications', 'nav_settings_mail')).toBe(200);
expect(priorities('group_notifications', 'nav_notifications')).toBe(400);
expect(priorities('group_notifications', 'nav_notification_events')).toBe(400);
// Public Forms last, after the integrations other packages contribute.
expect(priorities('group_integrations_dev', 'nav_api_keys')).toBe(100);
expect(priorities('group_integrations_dev', 'nav_public_forms')).toBe(500);
Expand Down Expand Up @@ -269,6 +276,26 @@ describe('Setup platform-owned entries: groups, order, names and aliases (#39057
});
}

it('Notification Events: its own entry after Delivery Log, named in every locale, and the only one that name finds', () => {
// The event list (`sys_notification`), whose toolbar carries Send In-App
// Message, gated on that action's capability (#39439).
expect(platformItem('nav_notification_events')).toMatchObject({
type: 'object', label: 'Notification Events', objectName: 'sys_notification', viewName: 'recent',
requiresObject: 'sys_notification', requiredPermissions: ['setup.write'],
});
const EVENTS: Record<Locale, string> = {
'en': 'Notification Events', 'zh-CN': '通知事件', 'zh-Hant': '通知事件', 'ja-JP': '通知イベント', 'ko': '알림 이벤트',
'es-ES': 'Eventos de notificación', 'fr': 'Événements de notification', 'pt-BR': 'Eventos de notificação',
'ru': 'События уведомлений', 'de': 'Benachrichtigungsereignisse', 'ar': 'أحداث الإشعارات',
};
for (const locale of LOCALES) {
expect({ locale, node: bundleNode(locale, 'nav_notification_events') }).toEqual({ locale, node: { label: EVENTS[locale] } });
}
// No other entry keeps the name as a search alias.
const all = SETUP_NAV_CONTRIBUTIONS.flatMap((c) => c.items as NavItem[]);
expect(all.filter((i) => (i.keywords ?? []).includes('Notification Events')).map((i) => i.id)).toEqual([]);
});

it('Business Units keeps its name and carries 部门 / 组织架构 / 事业部 (ruling D4)', () => {
const item = platformItem('nav_business_units');
expect(item?.label).toBe('Business Units');
Expand Down
Loading
Loading