From 5e6dcd6ea16c851295a54832d7c7376c76792441 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Thu, 12 Oct 2023 17:06:57 +0200 Subject: [PATCH] chore: streamline processes in template.py (#41) --- dsp_permissions_scripts/template.py | 38 ++++++++++++++++++----------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/dsp_permissions_scripts/template.py b/dsp_permissions_scripts/template.py index 2307d93e..2c7eec4c 100644 --- a/dsp_permissions_scripts/template.py +++ b/dsp_permissions_scripts/template.py @@ -46,17 +46,22 @@ def update_doaps( shortcode=shortcode, mode="original", ) - project_doaps_updated = modify_doaps(doaps=project_doaps) + project_doaps_modified = modify_doaps(doaps=project_doaps) + apply_updated_doaps_on_server( + doaps=project_doaps_modified, + host=host, + token=token, + ) + project_doaps_updated = get_doaps_of_project( + host=host, + shortcode=shortcode, + token=token, + ) serialize_doaps_of_project( project_doaps=project_doaps_updated, shortcode=shortcode, mode="modified", ) - apply_updated_doaps_on_server( - doaps=project_doaps_updated, - host=host, - token=token, - ) def update_oaps( @@ -75,25 +80,30 @@ def update_oaps( shortcode=shortcode, mode="original", ) - resource_oaps_updated = modify_oaps(oaps=resource_oaps) - serialize_resource_oaps( - resource_oaps=resource_oaps_updated, + resource_oaps_modified = modify_oaps(oaps=resource_oaps) + apply_updated_oaps_on_server( + resource_oaps=resource_oaps_modified, + host=host, + token=token, shortcode=shortcode, - mode="modified", ) - apply_updated_oaps_on_server( - resource_oaps=resource_oaps_updated, + resource_oaps_updated = get_all_resource_oaps_of_project( + shortcode=shortcode, host=host, token=token, + ) + serialize_resource_oaps( + resource_oaps=resource_oaps_updated, shortcode=shortcode, + mode="modified", ) def main() -> None: """ The main function provides you with 2 sample functions: - one to update the Object Access Permissions of a project, - and one to update the Default Object Access Permissions of a project. + one to update the Default Object Access Permissions of a project, + and one to update the Object Access Permissions of a project. Both must first be adapted to your needs. """ load_dotenv() # set login credentials from .env file as environment variables