Initial commit MKD fixes

This commit is contained in:
Arsen
2026-02-04 00:17:04 +05:00
commit de94ad707b
312 changed files with 138754 additions and 0 deletions

60
constants/roleAccess.ts Executable file
View File

@@ -0,0 +1,60 @@
/**
* Единый источник прав портала: роли, разделы по умолчанию, scope по умолчанию.
* Используется на фронте и синхронизируется с backend/constants/roleAccess.js.
*/
export type UserRole =
| 'DIRECTOR'
| 'ENGINEER'
| 'MASTER'
| 'LAWYER'
| 'FINANCIER'
| 'HR_MANAGER'
| 'PR_MANAGER';
/** Названия ролей для UI */
export const ROLE_NAMES: Record<UserRole, string> = {
DIRECTOR: 'Директор',
ENGINEER: 'Гл. Инженер',
MASTER: 'Мастер',
LAWYER: 'Юрист',
FINANCIER: 'Финансист',
HR_MANAGER: 'HR-менеджер',
PR_MANAGER: 'PR-менеджер',
};
/** Разделы по умолчанию для каждой роли (при пустом permissions) */
export const ROLE_ACCESS: Record<UserRole, string[]> = {
DIRECTOR: ['all'],
ENGINEER: ['dashboard', 'objects', 'requests', 'office', 'development'],
MASTER: ['objects', 'requests'],
LAWYER: ['dashboard', 'legal', 'objects', 'requests'],
FINANCIER: ['dashboard', 'finance', 'office', 'objects'],
HR_MANAGER: ['dashboard', 'hr', 'office'],
PR_MANAGER: ['dashboard', 'pr', 'requests'],
};
/** Scope по умолчанию для каждой роли */
export const ROLE_DEFAULT_SCOPE: Record<UserRole, 'all' | 'own_district'> = {
DIRECTOR: 'all',
ENGINEER: 'all',
MASTER: 'own_district',
LAWYER: 'all',
FINANCIER: 'all',
HR_MANAGER: 'all',
PR_MANAGER: 'all',
};
/** Список кодов разделов портала (порядок для allowedSections) */
export const SECTION_IDS: string[] = [
'dashboard',
'objects',
'requests',
'pr',
'finance',
'legal',
'development',
'hr',
'office',
'admin',
];