fix(ws): фильтрация уведомлений и подписок по роли

Refs EventHub/EventHubFrontAdmin#8

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 17:14:51 +03:00
parent 9deaa34a6e
commit 9ff894988f
3 changed files with 50 additions and 10 deletions
+13
View File
@@ -67,3 +67,16 @@ export function getMenuSelectedKey(pathname: string): string {
}
return pathname;
}
const WS_NOTIFICATION_ROUTES: Record<'report_created' | 'ticket_created', string> = {
report_created: '/reports',
ticket_created: '/tickets',
};
/** Доступ к WS-уведомлению по роли (согласовано с ROUTE_ACCESS). */
export function canReceiveWsNotification(
type: 'report_created' | 'ticket_created',
role: string | undefined
): boolean {
return canAccessRoute(WS_NOTIFICATION_ROUTES[type], role);
}