diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py index 600ad8986c9e425ce2afcac8f7553fa9a4df4cd6..9952156c0c1ac2979030da327ef75a4df416407a 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py @@ -775,6 +775,26 @@ def assign_system_permissions(): # Note: we only grant view permissions, since alteration is only permitted to users who are superuser anyway. + # extra actions + + # TODO: Verify that these permissions are correctly assigned! + # we could in principle generically assign permissions for GET/POST actions equivalent to view/change on the model + # itself, but the PO said it's probably not that simple. + for subtask_perm in ['get_progress_subtask', + 'input_dataproducts_subtask', + 'output_dataproducts_subtask', + 'parset_subtask', + 'predecessors_subtask', + 'process_feedback_and_set_to_finished_if_complete_subtask', + 'reprocess_raw_feedback_for_subtask_and_set_to_finished_if_complete_subtask', + 'state_log_subtask', + 'successors_subtask', + 'task_log_subtask', + 'transformed_output_dataproduct_subtask', + 'schedule_subtask', + 'unschedule_subtask']: + operator_group.permissions.add(Permission.objects.get(codename=subtask_perm)) + def populate_system_test_users(): # TODO: Set proper credentials (passwords at least) or remove before we hit production diff --git a/SAS/TMSS/backend/test/t_permissions_system_roles.py b/SAS/TMSS/backend/test/t_permissions_system_roles.py index d45efaa21a92fbf886fc5ba703ad1cddaa41e007..a6daa04805c88e1b9874ca6f2d41386a8ceb6651 100755 --- a/SAS/TMSS/backend/test/t_permissions_system_roles.py +++ b/SAS/TMSS/backend/test/t_permissions_system_roles.py @@ -121,6 +121,9 @@ class SystemPermissionTestCase(unittest.TestCase): # Retrieve operator system role cls.operator_group = Group.objects.get(name='operator') + def setUp(self): + super().setUp() + logger.info("Now running '%s'. If this times out, the permission polling is probably not stopping because the permission in question is not correctly assigned to the assigned group." % self._testMethodName) def test_SubtaskViewSet_has_TMSSPermissions_in_permission_classes(self): # Assert SubtaskViewSet has the TMSSPermissions permission class.