25 lines
616 B
Python
25 lines
616 B
Python
"""Чистая логика прав на состав проекта (без DB)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.merakomis_schema import ROLE_MAIN_ENGINEER
|
|
|
|
|
|
def evaluate_is_rw_member(
|
|
*,
|
|
is_admin_user: bool,
|
|
is_rp: bool,
|
|
acting_role: int,
|
|
is_dept_director: bool,
|
|
is_edit: bool,
|
|
target_in_subemps: bool,
|
|
) -> bool:
|
|
"""Порт Rules::isRwMember для unit-тестов."""
|
|
if is_admin_user or is_rp:
|
|
return True
|
|
if acting_role == ROLE_MAIN_ENGINEER:
|
|
return True
|
|
if is_edit:
|
|
return target_in_subemps
|
|
return is_dept_director
|