From a84a19ec0d08fa67527b0dcc0008a97a6b09d4ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sat, 30 Mar 2024 18:16:29 +0100 Subject: [PATCH] put mesh_control into user data --- src/c3nav/mapdata/api/updates.py | 4 ++++ src/c3nav/mapdata/utils/user.py | 1 + 2 files changed, 5 insertions(+) diff --git a/src/c3nav/mapdata/api/updates.py b/src/c3nav/mapdata/api/updates.py index aeea2a89..a3f02a87 100644 --- a/src/c3nav/mapdata/api/updates.py +++ b/src/c3nav/mapdata/api/updates.py @@ -31,6 +31,10 @@ class UserDataSchema(BaseSchema): title="control panel access", description="whether the user signed in can access the control panel.", ) + mesh_control: bool = APIField( + title="mesh control permission", + description="whether the user signed in can manage the mesh.", + ) has_positions: bool = APIField( title="user has positions", description="whether the user signed in has created any positions", diff --git a/src/c3nav/mapdata/utils/user.py b/src/c3nav/mapdata/utils/user.py index 93432ce4..a34326f5 100644 --- a/src/c3nav/mapdata/utils/user.py +++ b/src/c3nav/mapdata/utils/user.py @@ -13,6 +13,7 @@ def get_user_data(request): 'logged_in': bool(request.user.is_authenticated), 'allow_editor': can_access_editor(request), 'allow_control_panel': request.user_permissions.control_panel, + 'mesh_control': request.user_permissions.mesh_control, 'has_positions': Position.user_has_positions(request.user) } if permissions: