fix(ws): фильтрация уведомлений и подписок по роли
Refs EventHub/EventHubFrontAdmin#8 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user