diff --git a/msystems/services.py b/msystems/services.py index 75fb38b..e931bd6 100644 --- a/msystems/services.py +++ b/msystems/services.py @@ -75,14 +75,14 @@ def _update_user(self, user: User, user_data: dict) -> None: self._update_user_name(user.i_user, data_first_name, data_last_name) def _update_user_legal_entities(self, user: User, user_data: dict) -> None: - legal_entities = self._parse_legal_entities(user_data.get('OrganizationAdministrator')) + legal_entities = self._parse_legal_entities(user_data.get('OrganizationAdministrator', [])) policyholders = [self._get_or_create_policy_holder(user, line[1], line[0]) for line in legal_entities] self._delete_old_user_policyholders(user, policyholders) self._add_new_user_policyholders(user, policyholders) def _update_user_roles(self, user, user_data): - msystem_roles_list = user_data.get('Role') + msystem_roles_list = user_data.get('Role', [MsystemsConfig.EMPLOYER]) self._delete_old_user_roles(user, msystem_roles_list) self._add_new_user_roles(user, msystem_roles_list)