access denied fix

This commit is contained in:
Константин Лебединский
2026-04-30 13:31:54 +05:00
parent c4a7d2ef08
commit ebb58d4b5a
4 changed files with 75 additions and 37 deletions
+4
View File
@@ -38,6 +38,10 @@ def user_has_test_access(user_id: str, test_id: str) -> AccessResult:
if is_test_author(test.created_by, uid):
return AccessResult(ok=True, is_author=True, not_found=False)
# Глобальная политика доступа: любой активный тест доступен всем сотрудникам.
if bool(test.is_active):
return AccessResult(ok=True, is_author=False, not_found=False)
assigned = session.query(
exists().where(
TestAssignmentTarget.target_type == 'user',