From 11026b02fa2f1aa106419020b5f20cefe0bcf0fc Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 7 Apr 2023 11:11:23 -0400 Subject: [PATCH] get rid of a lot of cruft in config files, w/ jason --- .../src/spiffworkflow_backend/config/demo.py | 14 -- .../src/spiffworkflow_backend/config/dev.py | 14 -- .../config/permissions/local_development.yml | 168 +----------------- .../config/permissions/staging.yml | 148 --------------- .../src/spiffworkflow_backend/config/qa1.py | 16 -- .../src/spiffworkflow_backend/config/qa2.py | 2 +- .../config/sartography.py | 12 -- .../spiffworkflow_backend/config/staging.py | 9 - .../config/terraform_deployed_environment.py | 9 +- .../exceptions/api_error.py | 2 +- 10 files changed, 10 insertions(+), 384 deletions(-) delete mode 100644 spiffworkflow-backend/src/spiffworkflow_backend/config/demo.py delete mode 100644 spiffworkflow-backend/src/spiffworkflow_backend/config/dev.py delete mode 100644 spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/staging.yml delete mode 100644 spiffworkflow-backend/src/spiffworkflow_backend/config/qa1.py delete mode 100644 spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py delete mode 100644 spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/demo.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/demo.py deleted file mode 100644 index c96944897..000000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/demo.py +++ /dev/null @@ -1,14 +0,0 @@ -"""Demo environment.""" -from os import environ - -SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = True -SPIFFWORKFLOW_BACKEND_GIT_USERNAME = "demo" -SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = "demo@example.com" -SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get( - "SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME", - default="terraform_deployed_environment.yml", -) - -SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER = ( - environ.get("SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER", default="false") == "true" -) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/dev.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/dev.py deleted file mode 100644 index ef0250604..000000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/dev.py +++ /dev/null @@ -1,14 +0,0 @@ -"""Dev.""" -from os import environ - -SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH", default="staging" -) -SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_USERNAME", default="sartography-automated-committer" -) -SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL", - default="sartography-automated-committer@users.noreply.github.com", -) -SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = "dev.yml" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml index 558b9eaf9..049c991ed 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml @@ -1,70 +1,8 @@ default_group: everybody -users: - admin: - email: admin@spiffworkflow.org - password: admin - preferred_username: Admin - groups: admin: - users: - [ - admin@spiffworkflow.org, - jakub@status.im, - jarrad@status.im, - kb@sartography.com, - alex@sartography.com, - dan@sartography.com, - mike@sartography.com, - jason@sartography.com, - j@sartography.com, - elizabeth@sartography.com, - jon@sartography.com, - ] - - Finance Team: - users: - [ - jakub@status.im, - amir@status.im, - jarrad@status.im, - sasha@status.im, - fin@status.im, - fin1@status.im, - alex@sartography.com, - dan@sartography.com, - mike@sartography.com, - jason@sartography.com, - j@sartography.com, - elizabeth@sartography.com, - jon@sartography.com, - ] - - demo: - users: - [ - harmeet@status.im, - sasha@status.im, - manuchehr@status.im, - core@status.im, - fin@status.im, - fin1@status.im, - lead@status.im, - lead1@status.im, - ] - - test: - users: - [ - natalia@sartography.com, - ] - - admin-ro: - users: - [ - j@sartography.com, - ] + users: [admin@spiffworkflow.org] permissions: admin: @@ -72,107 +10,3 @@ permissions: users: [] allowed_permissions: [create, read, update, delete] uri: /* - admin-readonly: - groups: [admin-ro] - users: [] - allowed_permissions: [read] - uri: /* - admin-process-instances-for-readonly: - groups: [admin-ro] - users: [] - allowed_permissions: [create, read, update, delete] - uri: /process-instances/* - - # open system defaults for everybody - read-all-process-groups: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /process-groups/* - read-all-process-models: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /process-models/* - - # basic perms for everybody - read-all-process-instances-for-me: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/* - read-process-instance-reports: - groups: [everybody] - users: [] - allowed_permissions: [create, read, update, delete] - uri: /process-instances/reports/* - read-process-instances-find-by-id: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /process-instances/find-by-id/* - processes-read: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /processes - service-tasks: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /service-tasks - tasks-crud: - groups: [everybody] - users: [] - allowed_permissions: [create, read, update, delete] - uri: /tasks/* - user-groups-for-current-user: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /user-groups/for-current-user - - - finance-admin: - groups: ["Finance Team"] - users: [] - allowed_permissions: [create, read, update, delete] - uri: /process-groups/manage-procurement:procurement:* - - manage-revenue-streams-instances: - groups: ["demo"] - users: [] - allowed_permissions: [create] - uri: /process-instances/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* - manage-procurement-invoice-instances: - groups: ["demo"] - users: [] - allowed_permissions: [create] - uri: /process-instances/manage-procurement:procurement:core-contributor-invoice-management:* - manage-procurement-instances: - groups: ["demo"] - users: [] - allowed_permissions: [create] - uri: /process-instances/manage-procurement:vendor-lifecycle-management:* - - manage-revenue-streams-instances-for-me: - groups: ["demo"] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* - manage-procurement-invoice-instances-for-me: - groups: ["demo"] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/manage-procurement:procurement:core-contributor-invoice-management:* - manage-procurement-instances-for-me: - groups: ["demo"] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/manage-procurement:vendor-lifecycle-management:* - - create-test-instances: - groups: ["test"] - users: [] - allowed_permissions: [create, read] - uri: /process-instances/misc:test:* diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/staging.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/staging.yml deleted file mode 100644 index 9816ca939..000000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/staging.yml +++ /dev/null @@ -1,148 +0,0 @@ -default_group: everybody - -groups: - admin: - users: - [ - admin@spiffworkflow.org, - jakub@status.im, - jarrad@status.im, - kb@sartography.com, - alex@sartography.com, - dan@sartography.com, - mike@sartography.com, - jason@sartography.com, - j@sartography.com, - elizabeth@sartography.com, - jon@sartography.com, - ] - - Finance Team: - users: - [ - jakub@status.im, - amir@status.im, - jarrad@status.im, - sasha@status.im, - fin@status.im, - fin1@status.im, - alex@sartography.com, - dan@sartography.com, - mike@sartography.com, - jason@sartography.com, - j@sartography.com, - elizabeth@sartography.com, - jon@sartography.com, - ] - - demo: - users: - [ - harmeet@status.im, - sasha@status.im, - manuchehr@status.im, - core@status.im, - fin@status.im, - fin1@status.im, - lead@status.im, - lead1@status.im, - ] - test: - users: - [ - natalia@sartography.com, - ] - -permissions: - admin: - groups: [admin] - users: [] - allowed_permissions: [read] - uri: /* - admin-process-instances: - groups: [admin] - users: [] - allowed_permissions: [create, read, update, delete] - uri: /process-instances/* - - # open system defaults for everybody - read-all-process-groups: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /process-groups/* - read-all-process-models: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /process-models/* - - # basic perms for everybody - read-all-process-instances-for-me: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/* - read-process-instance-reports: - groups: [everybody] - users: [] - allowed_permissions: [create, read, update, delete] - uri: /process-instances/reports/* - processes-read: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /processes - service-tasks: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /service-tasks - tasks-crud: - groups: [everybody] - users: [] - allowed_permissions: [create, read, update, delete] - uri: /tasks/* - user-groups-for-current-user: - groups: [everybody] - users: [] - allowed_permissions: [read] - uri: /user-groups/for-current-user - - manage-revenue-streams-instances: - groups: ["demo"] - users: [] - allowed_permissions: [create] - uri: /process-instances/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* - manage-procurement-invoice-instances: - groups: ["demo"] - users: [] - allowed_permissions: [create] - uri: /process-instances/manage-procurement:procurement:core-contributor-invoice-management:* - manage-procurement-instances: - groups: ["demo"] - users: [] - allowed_permissions: [create] - uri: /process-instances/manage-procurement:vendor-lifecycle-management:* - - manage-revenue-streams-instances-for-me: - groups: ["demo"] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* - manage-procurement-invoice-instances-for-me: - groups: ["demo"] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/manage-procurement:procurement:core-contributor-invoice-management:* - manage-procurement-instances-for-me: - groups: ["demo"] - users: [] - allowed_permissions: [read] - uri: /process-instances/for-me/manage-procurement:vendor-lifecycle-management:* - - create-test-instances: - groups: ["test"] - users: [] - allowed_permissions: [create, read] - uri: /process-instances/misc:test:* diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/qa1.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/qa1.py deleted file mode 100644 index ac56d84f1..000000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/qa1.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Qa1.""" -from os import environ - -SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH", default="qa2" -) -SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_USERNAME", default="sartography-automated-committer" -) -SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL", - default=f"{SPIFFWORKFLOW_BACKEND_GIT_USERNAME}@users.noreply.github.com", -) -SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get( - "SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME", default="qa1.yml" -) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/qa2.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/qa2.py index b5ac6cee1..250dba7f5 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/qa2.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/qa2.py @@ -1,4 +1,4 @@ -"""Qa2.""" +"""qa2 just here as an example of path based routing for apps.""" from os import environ SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get( diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py deleted file mode 100644 index 8dd2e1a05..000000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Default.""" -from os import environ - -environment_identifier_for_this_config_file_only = environ["SPIFFWORKFLOW_BACKEND_ENV"] -SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL = ( - f"https://keycloak.{environment_identifier_for_this_config_file_only}.spiffworkflow.org/realms/sartography" -) -SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH = environ.get("SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH", default="main") -SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL", - default="https://github.com/sartography/sartography-process-models.git", -) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py deleted file mode 100644 index 55df0c168..000000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py +++ /dev/null @@ -1,9 +0,0 @@ -"""Staging.""" -from os import environ - -SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH = environ.get("SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH", default="staging") -SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH", default="main" -) -SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = False -SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = "staging.yml" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py index 1585b5778..985047b7c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py @@ -5,8 +5,13 @@ from os import environ environment_identifier_for_this_config_file_only = environ["SPIFFWORKFLOW_BACKEND_ENV"] SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = True -SPIFFWORKFLOW_BACKEND_GIT_USERNAME = "sartography-automated-committer" -SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = f"{SPIFFWORKFLOW_BACKEND_GIT_USERNAME}@users.noreply.github.com" +SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get( + "SPIFFWORKFLOW_BACKEND_GIT_USERNAME", default="sartography-automated-committer" +) +SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = environ.get( + "SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL", + default=f"{SPIFFWORKFLOW_BACKEND_GIT_USERNAME}@users.noreply.github.com", +) SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get( "SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME", default="terraform_deployed_environment.yml", diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py b/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py index 9b73536cf..923ff1f54 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py @@ -128,7 +128,7 @@ class ApiError(Exception): instance = cls(code, message, status_code=status_code) instance.task_id = task_spec.name or "" instance.task_name = task_spec.description or "" - if hasattr(task_spec, '_wf_spec') and task_spec._wf_spec: + if hasattr(task_spec, "_wf_spec") and task_spec._wf_spec: instance.file_name = task_spec._wf_spec.file return instance