Files
ACORE/apps/rro/access.py
T
2026-09-21 20:37:18 +03:00

14 lines
726 B
Python

"""Права на операции РРО; область данных — core.location_access."""
from core.portal_access import user_can_access
def can_edit_rro_registers(user) -> bool:
"""Создание/редактирование — только staff (офис/IT), не заведующие."""
return bool(user and user.is_authenticated and (user.is_staff or user.is_superuser))
def user_can_access_register(user, register) -> bool:
"""Проверка доступа к конкретной записи (для update)."""
from core.location_access import accessible_pharmacies
return user_can_access(user, 'rro') and accessible_pharmacies(user).filter(pk=register.pharmacy_id).exists()