From f054b357804432cf64f90a80068eb1e40967790a Mon Sep 17 00:00:00 2001 From: Mikko Nieminen Date: Tue, 31 Oct 2023 18:32:08 +0100 Subject: [PATCH] update fix (#1315, #1320) --- projectroles/remote_projects.py | 8 +++++++- projectroles/tests/test_remote_projects_api.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/projectroles/remote_projects.py b/projectroles/remote_projects.py index e82e2bbf..9b166df3 100644 --- a/projectroles/remote_projects.py +++ b/projectroles/remote_projects.py @@ -1050,7 +1050,13 @@ def _sync_app_setting(cls, uuid, set_data): project = Project.objects.get(sodar_uuid=ad['project_uuid']) # TODO: Use UUID for LDAP users once #1316 and #1317 are implemented if ad.get('user_name'): - user = User.objects.get(username=ad['user_name']) + # User may not be found if e.g. local users allowed but not created + user = User.objects.filter(username=ad['user_name']).first() + if not user: + logger.info( + 'Skipping setting {}: User not found'.format(ad['name']) + ) + return # Skip for now, as UUIDs have not been correctly synced # TODO: Remove skip after #1316 and #1317 elif ad['user_uuid']: diff --git a/projectroles/tests/test_remote_projects_api.py b/projectroles/tests/test_remote_projects_api.py index 5e22abb7..d423ee87 100644 --- a/projectroles/tests/test_remote_projects_api.py +++ b/projectroles/tests/test_remote_projects_api.py @@ -1970,4 +1970,4 @@ def test_update_no_changes(self): ] = 'updated' self.assertEqual(original_data, remote_data) - # TODO: Test for USER and PROJECT_USER settings + # TODO: Test syncing of PROJECT_USER settings with differing user UUIDs