From 78ee70c0b790544504888b5cc668be005b7ef3d5 Mon Sep 17 00:00:00 2001 From: Mikko Nieminen Date: Tue, 11 Jun 2024 17:16:44 +0200 Subject: [PATCH] update addremotesite command (#817) --- projectroles/management/commands/addremotesite.py | 11 +++++++++++ projectroles/tests/test_commands.py | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/projectroles/management/commands/addremotesite.py b/projectroles/management/commands/addremotesite.py index d5cbad5e..066c276a 100644 --- a/projectroles/management/commands/addremotesite.py +++ b/projectroles/management/commands/addremotesite.py @@ -81,6 +81,16 @@ def add_arguments(self, parser): type=bool, help='User display of the remote site', ) + parser.add_argument( + '-o', + '--owner-modifiable', + dest='owner_modifiable', + default=True, + required=False, + type=bool, + help='Allow owners and delegates to modify project access for this ' + 'site', + ) # Additional Arguments parser.add_argument( '-s', @@ -137,6 +147,7 @@ def handle(self, *args, **options): 'description': options['description'], 'secret': options['secret'], 'user_display': options['user_display'], + 'owner_modifiable': options['owner_modifiable'], } site = RemoteSite.objects.create(**create_kw) diff --git a/projectroles/tests/test_commands.py b/projectroles/tests/test_commands.py index ec4900f1..e0417e18 100644 --- a/projectroles/tests/test_commands.py +++ b/projectroles/tests/test_commands.py @@ -103,6 +103,7 @@ def setUp(self): 'description': '', 'secret': REMOTE_SITE_SECRET, 'user_display': True, + 'owner_modifiable': False, 'suppress_error': False, } @@ -124,7 +125,7 @@ def test_add(self): 'secret': REMOTE_SITE_SECRET, 'sodar_uuid': site.sodar_uuid, 'user_display': True, - 'owner_modifiable': True, + 'owner_modifiable': False, } self.assertEqual(model_to_dict(site), expected) self.assertEqual(TimelineEvent.objects.filter(**tl_kwargs).count(), 1)