From 862be7b57f2c482405459887da4c3f5d800106b2 Mon Sep 17 00:00:00 2001 From: Alain Mazy Date: Wed, 19 Jun 2024 14:04:34 +0200 Subject: [PATCH] fix serialization of permission.json --- sources/orthanc_auth_service/permissions.json | 21 ++++++++++++++----- .../shares/roles_configuration.py | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sources/orthanc_auth_service/permissions.json b/sources/orthanc_auth_service/permissions.json index 3e7b95f..7988cc3 100644 --- a/sources/orthanc_auth_service/permissions.json +++ b/sources/orthanc_auth_service/permissions.json @@ -1,15 +1,26 @@ { "roles": { "admin-role": { - "authorized_labels": [ + "authorized-labels": [ "*" ], "permissions": [ - "all" + "anonymize", + "delete", + "download", + "modify", + "send", + "share", + "view", + "settings", + "edit-labels", + "admin-permissions", + "upload", + "q-r-remote-modalities" ] }, "doctor-role": { - "authorized_labels": [ + "authorized-labels": [ "*" ], "permissions": [ @@ -20,7 +31,7 @@ ] }, "external-role": { - "authorized_labels": [ + "authorized-labels": [ "external" ], "permissions": [ @@ -29,5 +40,5 @@ ] } }, - "allowed_labels": [] + "allowed-labels": [] } \ No newline at end of file diff --git a/sources/orthanc_auth_service/shares/roles_configuration.py b/sources/orthanc_auth_service/shares/roles_configuration.py index 60cfdb9..252b78f 100644 --- a/sources/orthanc_auth_service/shares/roles_configuration.py +++ b/sources/orthanc_auth_service/shares/roles_configuration.py @@ -40,7 +40,7 @@ def update_configured_roles(self, new_configuration: RolesConfigurationModel): logging.warning(f"Writing the new roles and permissions to configuration file ({self._permissions_file_path})") with open(self._permissions_file_path, "wt") as f: - f.write(self._configured_roles.model_dump_json(indent=2)) + f.write(self._configured_roles.model_dump_json(indent=2, by_alias=True)) def get_role_configuration(self, user_roles: List[str]) -> RolePermissions: configured_user_roles = []