♻️(backend) simplify further select options on link reach/role

We reduce the number of options even more by treating link reach
and link role independently: link reach must be higher than its
ancestors' equivalent link reach and link role must be higher than
its ancestors' link role.

This reduces the number of possibilities but we decided to start
with the most restrictive and simple offer and extend it if we
realize it faces too many criticism instead of risking to offer
too many options that are too complex and must be reduced afterwards.
This commit is contained in:
Samuel Paccoud - DINUM
2025-05-09 08:05:38 +02:00
committed by Anthony LC
parent d0eb2275e5
commit d232654c55
2 changed files with 16 additions and 46 deletions

View File

@@ -1186,7 +1186,6 @@ def test_models_documents_restore_complex_bis(django_assert_num_queries):
@pytest.mark.parametrize(
"reach, role, select_options",
[
# One ancestor
(
"public",
"reader",
@@ -1206,7 +1205,7 @@ def test_models_documents_restore_complex_bis(django_assert_num_queries):
(
"authenticated",
"editor",
{"authenticated": ["editor"], "public": ["reader", "editor"]},
{"authenticated": ["editor"], "public": ["editor"]},
),
(
"restricted",
@@ -1222,18 +1221,16 @@ def test_models_documents_restore_complex_bis(django_assert_num_queries):
"editor",
{
"restricted": None,
"authenticated": ["reader", "editor"],
"public": ["reader", "editor"],
"authenticated": ["editor"],
"public": ["editor"],
},
),
# No ancestors (edge case)
# Edge cases
(
"public",
None,
{
"public": ["reader", "editor"],
"authenticated": ["reader", "editor"],
"restricted": None,
},
),
(