From 60f71813408acc113d4947c2f746390cc2aecad5 Mon Sep 17 00:00:00 2001 From: Lucian N Date: Mon, 20 Nov 2023 10:32:17 +0200 Subject: [PATCH 1/2] Update model.py fix for #830 --- sign_client/sign_client/model.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sign_client/sign_client/model.py b/sign_client/sign_client/model.py index f2022a63..4e895623 100644 --- a/sign_client/sign_client/model.py +++ b/sign_client/sign_client/model.py @@ -195,10 +195,7 @@ class UserGroupInfo: def from_dict(cls, dct): new_dct = {} for k, v in dct.items(): - if k == 'settings': - new_dct[k] = SettingsInfo.from_dict(v) - else: - new_dct[k] = v + new_dct[k] = v return cls(**new_dct) From 129548861cf3554b766dd547f844832fedac41d1 Mon Sep 17 00:00:00 2001 From: Lucian N Date: Tue, 21 Nov 2023 10:23:43 +0200 Subject: [PATCH 2/2] Update model.py reviewed fix for keeping class model as before and check if a boolean is sent over instead of a dict _canUseMulticastWorkflows_ will not even appear in the final SettingsInfo class because of the _remove_unknown_keys_ function which limits results to: libaryDocumentCreationVisible: BooleanSettingsInfo = None sendRestrictedToWorkflows: BooleanSettingsInfo = None userCanSend: BooleanSettingsInfo = None userManagedWorkflowsEnabled: BooleanSettingsInfo = None allowedToShareUserCreatedWorkflows: BooleanSettingsInfo = None --- sign_client/sign_client/model.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sign_client/sign_client/model.py b/sign_client/sign_client/model.py index 4e895623..6a5d6558 100644 --- a/sign_client/sign_client/model.py +++ b/sign_client/sign_client/model.py @@ -159,9 +159,11 @@ def from_dict(cls, dct): class BooleanSettingsInfo: value: bool inherited: bool = None - + @classmethod def from_dict(cls, dct): + if isinstance(dct, bool): + return dct return cls(**dct) @@ -195,7 +197,10 @@ class UserGroupInfo: def from_dict(cls, dct): new_dct = {} for k, v in dct.items(): - new_dct[k] = v + if k == 'settings': + new_dct[k] = SettingsInfo.from_dict(v) + else: + new_dct[k] = v return cls(**new_dct)