From 2adf18d98618a0349b86d327cf86ddd3998dd565 Mon Sep 17 00:00:00 2001 From: Andreas Poulsen Date: Mon, 8 May 2023 12:54:23 +0200 Subject: [PATCH 1/3] Fix associated scripts password input bug --- admin_site/system/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admin_site/system/models.py b/admin_site/system/models.py index 4c033706..1f278203 100755 --- a/admin_site/system/models.py +++ b/admin_site/system/models.py @@ -527,7 +527,9 @@ def update_policy_from_request(self, request, submit_name): else: par.file_value = req_files[param_name] else: - if param_name not in req_params: + if param_name not in req_params or ( + not req_params[param_name] and inp.value_type == Input.PASSWORD + ): if par.pk is not None: # Don't blank existing values continue From 520f9a04e05bf8c0fafea6e924ce3de246b3921e Mon Sep 17 00:00:00 2001 From: Marcus Funch Date: Mon, 8 May 2023 14:21:03 +0200 Subject: [PATCH 2/3] Add test data using the password input type and empty parameters Test data: Move list of AssociatedScripts to Group 1 So we're more likely to run into AssociatedScript bugs while testing --- .../system_fixtures/100_system.json | 265 +++++++++++++++--- 1 file changed, 222 insertions(+), 43 deletions(-) diff --git a/dev-environment/system_fixtures/100_system.json b/dev-environment/system_fixtures/100_system.json index 413a6c71..b9db189a 100755 --- a/dev-environment/system_fixtures/100_system.json +++ b/dev-environment/system_fixtures/100_system.json @@ -4615,7 +4615,7 @@ "pk": 9, "fields": { "created": "2021-08-10T09:12:51.835", - "modified": "2022-01-26T15:15:57.250", + "modified": "2023-05-08T14:12:46.883", "user_created": "", "user_modified": "magenta", "name": "Chrome - Skift startside", @@ -5140,10 +5140,10 @@ "pk": 35, "fields": { "created": "2021-08-10T09:12:51.835", - "modified": "2021-10-08T16:03:07.664", + "modified": "2023-05-08T14:14:39.285", "user_created": "", - "user_modified": "mowgli", - "name": "System - Skift password for bruger", + "user_modified": "magenta", + "name": "System - Skift kodeord for Borger", "uid": null, "description": "Skifter publikumsbrugerens password til det angivne.\r\n\r\nParametre:\r\n\r\n-password\r\n-passwordigen - det nye password og en gentagelse, for at sikre at brugeren kan skrive det to gange.\r\n\r\nDa publikumsbrugeren logger ind automatisk, er det normalt ikke nødvendigt at sætte et password for denne bruger.\r\n\r\nPasswords vises p.t. i klartekst, når man indtaster dem. Pas derfor på ikke at blive kigget over skulderen e.l.\r\n\r\nTestet på Ubuntu 20.04.", "site": null, @@ -5161,10 +5161,10 @@ "pk": 36, "fields": { "created": "2021-08-10T09:12:51.835", - "modified": "2021-09-30T13:42:57.053", + "modified": "2023-05-08T14:17:13.412", "user_created": "", - "user_modified": "flash_gordon", - "name": "System - Skift password for superbruger", + "user_modified": "magenta", + "name": "System - Skift kodeord for superuser", "uid": null, "description": "Skift til det angivne superbrugerpassword.\r\n\r\nParametre:\r\n\r\n-password\r\n-passwordigen - det nye password og en gentagelse, for at sikre at brugeren kan skrive det to gange.\r\n\r\nDet er MEGET VIGTIGT at skifte fra standard-passwordet til et andet, så snart en BibOS-maskine er færdiginstalleret. Passwords vises p.t. i klartekst, når man indtaster dem. Pas derfor på ikke at blive kigget over skulderen e.l.\r\n\r\nTestet på Ubuntu 20.04.", "site": null, @@ -5546,6 +5546,25 @@ "tags": [] } }, +{ + "model": "system.script", + "pk": 84, + "fields": { + "created": "2023-05-08T14:18:22.789", + "modified": "2023-05-08T14:18:31.724", + "user_created": "magenta", + "user_modified": "magenta", + "name": "Script med valgfrit parameter", + "uid": null, + "description": "test", + "site": 1, + "executable_code": "script_uploads/emptyish.sh", + "is_security_script": false, + "is_hidden": false, + "maintained_by_magenta": false, + "tags": [] + } +}, { "model": "system.batch", "pk": 1, @@ -6068,11 +6087,29 @@ "site": 1 } }, +{ + "model": "system.batch", + "pk": 59, + "fields": { + "name": "Gruppe4", + "script": 36, + "site": 1 + } +}, +{ + "model": "system.batch", + "pk": 60, + "fields": { + "name": "Gruppe4", + "script": 84, + "site": 1 + } +}, { "model": "system.associatedscript", "pk": 6, "fields": { - "group": 9, + "group": 10, "script": 8, "position": 0 } @@ -6081,7 +6118,7 @@ "model": "system.associatedscript", "pk": 7, "fields": { - "group": 9, + "group": 10, "script": 9, "position": 1 } @@ -6099,63 +6136,63 @@ "model": "system.associatedscript", "pk": 12, "fields": { - "group": 9, + "group": 10, "script": 8, - "position": 3 + "position": 2 } }, { "model": "system.associatedscript", "pk": 13, "fields": { - "group": 9, + "group": 10, "script": 6, - "position": 4 + "position": 3 } }, { "model": "system.associatedscript", "pk": 14, "fields": { - "group": 9, + "group": 10, "script": 7, - "position": 5 + "position": 4 } }, { "model": "system.associatedscript", "pk": 15, "fields": { - "group": 9, + "group": 10, "script": 10, - "position": 6 + "position": 5 } }, { "model": "system.associatedscript", "pk": 16, "fields": { - "group": 9, + "group": 10, "script": 9, - "position": 7 + "position": 6 } }, { "model": "system.associatedscript", "pk": 17, "fields": { - "group": 9, + "group": 10, "script": 27, - "position": 8 + "position": 7 } }, { "model": "system.associatedscript", "pk": 18, "fields": { - "group": 9, + "group": 10, "script": 31, - "position": 9 + "position": 8 } }, { @@ -6293,6 +6330,24 @@ "position": 14 } }, +{ + "model": "system.associatedscript", + "pk": 36, + "fields": { + "group": 10, + "script": 36, + "position": 9 + } +}, +{ + "model": "system.associatedscript", + "pk": 37, + "fields": { + "group": 10, + "script": 84, + "position": 10 + } +}, { "model": "system.job", "pk": 1, @@ -9513,6 +9568,90 @@ "pc": 31 } }, +{ + "model": "system.job", + "pk": 239, + "fields": { + "status": "NEW", + "log_output": "", + "created": "2023-05-08T14:14:59.762", + "started": null, + "finished": null, + "user": 35, + "batch": 59, + "pc": 26 + } +}, +{ + "model": "system.job", + "pk": 240, + "fields": { + "status": "NEW", + "log_output": "", + "created": "2023-05-08T14:14:59.764", + "started": null, + "finished": null, + "user": 35, + "batch": 59, + "pc": 28 + } +}, +{ + "model": "system.job", + "pk": 241, + "fields": { + "status": "NEW", + "log_output": "", + "created": "2023-05-08T14:14:59.765", + "started": null, + "finished": null, + "user": 35, + "batch": 59, + "pc": 23 + } +}, +{ + "model": "system.job", + "pk": 242, + "fields": { + "status": "NEW", + "log_output": "", + "created": "2023-05-08T14:18:45.340", + "started": null, + "finished": null, + "user": 35, + "batch": 60, + "pc": 26 + } +}, +{ + "model": "system.job", + "pk": 243, + "fields": { + "status": "NEW", + "log_output": "", + "created": "2023-05-08T14:18:45.341", + "started": null, + "finished": null, + "user": 35, + "batch": 60, + "pc": 28 + } +}, +{ + "model": "system.job", + "pk": 244, + "fields": { + "status": "NEW", + "log_output": "", + "created": "2023-05-08T14:18:45.341", + "started": null, + "finished": null, + "user": 35, + "batch": 60, + "pc": 23 + } +}, { "model": "system.input", "pk": 1, @@ -9531,7 +9670,7 @@ "fields": { "name": "URL", "value_type": "STRING", - "default_value": null, + "default_value": "", "position": 0, "mandatory": true, "script": 9 @@ -9866,8 +10005,8 @@ "pk": 30, "fields": { "name": "password", - "value_type": "STRING", - "default_value": null, + "value_type": "PASSWORD", + "default_value": "", "position": 0, "mandatory": true, "script": 35 @@ -9878,8 +10017,8 @@ "pk": 31, "fields": { "name": "password_igen", - "value_type": "STRING", - "default_value": null, + "value_type": "PASSWORD", + "default_value": "", "position": 1, "mandatory": true, "script": 35 @@ -9890,8 +10029,8 @@ "pk": 32, "fields": { "name": "password", - "value_type": "STRING", - "default_value": null, + "value_type": "PASSWORD", + "default_value": "", "position": 0, "mandatory": true, "script": 36 @@ -9902,8 +10041,8 @@ "pk": 33, "fields": { "name": "password_igen", - "value_type": "STRING", - "default_value": null, + "value_type": "PASSWORD", + "default_value": "", "position": 1, "mandatory": true, "script": 36 @@ -10283,14 +10422,14 @@ }, { "model": "system.input", - "pk": 94, + "pk": 95, "fields": { "name": "test", "value_type": "STRING", "default_value": "", - "position": 1, - "mandatory": true, - "script": 9 + "position": 0, + "mandatory": false, + "script": 84 } }, { @@ -10353,6 +10492,36 @@ "batch": 43 } }, +{ + "model": "system.batchparameter", + "pk": 7, + "fields": { + "string_value": "hey", + "file_value": "", + "input": 32, + "batch": 59 + } +}, +{ + "model": "system.batchparameter", + "pk": 8, + "fields": { + "string_value": "hey", + "file_value": "", + "input": 33, + "batch": 59 + } +}, +{ + "model": "system.batchparameter", + "pk": 9, + "fields": { + "string_value": "", + "file_value": "", + "input": 95, + "batch": 60 + } +}, { "model": "system.associatedscriptparameter", "pk": 5, @@ -10385,22 +10554,32 @@ }, { "model": "system.associatedscriptparameter", - "pk": 8, + "pk": 10, "fields": { - "string_value": "", + "string_value": "woop", "file_value": "", - "input": 94, - "associated_script": 7 + "input": 32, + "associated_script": 36 } }, { "model": "system.associatedscriptparameter", - "pk": 9, + "pk": 11, + "fields": { + "string_value": "hey", + "file_value": "", + "input": 33, + "associated_script": 36 + } +}, +{ + "model": "system.associatedscriptparameter", + "pk": 12, "fields": { "string_value": "", "file_value": "", - "input": 94, - "associated_script": 16 + "input": 95, + "associated_script": 37 } }, { From 762fc7b59816b716ea5e720330fea8c02e4a2b42 Mon Sep 17 00:00:00 2001 From: Andreas Poulsen Date: Mon, 8 May 2023 14:38:26 +0200 Subject: [PATCH 3/3] Update NEWS.rst and bump Version --- NEWS.rst | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS.rst b/NEWS.rst index b7f8b03b..d3811c24 100755 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,8 @@ +Version 5.14.1, May 8, 2023 +--------------------------- + +- Fix bug causing MandatoryParameterMissingError when saving a group with an associated script that uses password input + Version 5.14.0, May 3, 2023 --------------------------- diff --git a/VERSION b/VERSION index 0a70cf03..bcce971f 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.14.0 +5.14.1