fix: zentrale Lebensmittel fuer Admins aenderbar
Persoenliche Liste bleibt beim Owner; zentrale Eintraege oeffnen den Admin-Editor. Admin-Katalog trennt beide Listen, persoenliche bleiben sichtbar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9a0767c8ac
commit
e452d9a8fe
13 files changed
+134
-45
No files matched your search
@@ -1,5 +1,6 @@
|
||||
from data_layer.food_visibility import (
|
||||
attach_visibility,
|
||||
can_edit_food,
|
||||
is_global_mapping_target,
|
||||
is_visible_to,
|
||||
require_mapping_target,
|
||||
@@ -9,6 +10,18 @@ from data_layer.food_visibility import (
|
||||
)
|
||||
|
||||
|
||||
def test_can_edit_central_only_as_admin():
|
||||
central = {"catalog_kind": "manual_admin", "owner_profile_id": None, "is_active": True}
|
||||
personal = {"catalog_kind": "manual_user", "owner_profile_id": "alice", "is_active": True}
|
||||
bls = {"catalog_kind": "official_bls", "owner_profile_id": None, "is_active": True}
|
||||
assert can_edit_food(central, "alice", is_admin=False) is False
|
||||
assert can_edit_food(central, "alice", is_admin=True) is True
|
||||
assert can_edit_food(personal, "alice", is_admin=False) is True
|
||||
assert can_edit_food(personal, "bob", is_admin=False) is False
|
||||
assert can_edit_food(personal, "bob", is_admin=True) is True
|
||||
assert can_edit_food(bls, "alice", is_admin=True) is False
|
||||
|
||||
|
||||
def test_same_id_ignores_dashes_and_case():
|
||||
assert same_id("AaBbCcDd-0000-0000-0000-000000000001", "aabbccdd000000000000000000000001")
|
||||
|
||||
|
||||
Reference in new issue
Block a user