Add RRO, portal section perms, dislocation presets, and hiring intern flow.

Ship cash-register registry, section-based portal access, configurable dislocation columns, and trial-hire intern accounts with credentials PDF.
This commit is contained in:
2026-08-09 14:58:17 +03:00
parent 237275abd0
commit ae5c1f1848
63 changed files with 5987 additions and 2217 deletions
+69
View File
@@ -0,0 +1,69 @@
"""Реестр разделов портала — единый источник для меню и проверки на view."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class PortalSection:
key: str
path: str
label: str
nav: str # main | manage | support | none
perm: str | None = None # 'core.access_<key>' or None = any authenticated
# Ограниченные разделы — нужны Django permissions core.access_*
RESTRICTED_KEYS = (
'hr_portal',
'recruiting',
'structure',
'timetrack',
'databases',
'reports',
'purchases',
'email',
'it_manager',
'ad_mapping',
)
PORTAL_SECTIONS: dict[str, PortalSection] = {
'dashboard': PortalSection('dashboard', '/dashboard/', 'Главная', 'main'),
'news': PortalSection('news', '/news/', 'Новости', 'main'),
'employees': PortalSection('employees', '/employees/', 'Сотрудники', 'main'),
'tasks': PortalSection('tasks', '/tasks/', 'Задачи', 'main'),
'dislocation': PortalSection('dislocation', '/dislocation/', 'Дислокация', 'main'),
'documents': PortalSection('documents', '/documents/', 'Документы', 'main'),
'email': PortalSection('email', '/email/', 'Почта', 'main', 'core.access_email'),
'chat': PortalSection('chat', '/chat/', 'Чат', 'main'),
'calendar': PortalSection('calendar', '/calendar/', 'Календарь', 'main'),
'databases': PortalSection('databases', '/databases/', 'Базы данных', 'main', 'core.access_databases'),
'reports': PortalSection('reports', '/reports/', 'Отчёты', 'main', 'core.access_reports'),
'purchases': PortalSection('purchases', '/purchases/', 'Закупки', 'main', 'core.access_purchases'),
'hr_portal': PortalSection('hr_portal', '/hr-portal/', 'HR-портал', 'main', 'core.access_hr_portal'),
'settings': PortalSection('settings', '/settings/', 'Настройки', 'main'),
'profile': PortalSection('profile', '/profile/', 'Профиль', 'none'),
'structure': PortalSection('structure', '/structure/', 'Структура', 'manage', 'core.access_structure'),
'pharmacies': PortalSection('pharmacies', '/pharmacies/', 'Аптеки', 'manage'),
'pharmacy_detail': PortalSection('pharmacy_detail', '/pharmacies/', 'Карточка аптеки', 'none'),
'rro': PortalSection('rro', '/rro/', 'РРО / ПРРО', 'manage'),
'utilities': PortalSection('utilities', '/utilities/', 'Коммунальные услуги', 'manage'),
'recruiting': PortalSection('recruiting', '/recruiting/', 'Рекрутинг', 'manage', 'core.access_recruiting'),
'timetrack': PortalSection('timetrack', '/timetrack/', 'Учёт рабочего времени', 'manage', 'core.access_timetrack'),
'help': PortalSection('help', '/help/', 'Помощь', 'support'),
'it_support': PortalSection('it_support', '/it-support/', 'IT-поддержка', 'support'),
'it_manager': PortalSection('it_manager', '/it-manager/', 'IT-отдел', 'support', 'core.access_it_manager'),
'ad_mapping': PortalSection('ad_mapping', '/ad-mapping/', 'Active Directory', 'support', 'core.access_ad_mapping'),
}
def get_section(key: str) -> PortalSection | None:
return PORTAL_SECTIONS.get(key)
def portal_permission_codenames() -> list[tuple[str, str]]:
"""Список (codename, name) для Meta.permissions модели PortalAccess."""
return [
(f'access_{key}', f'Доступ к разделу: {PORTAL_SECTIONS[key].label}')
for key in RESTRICTED_KEYS
]