1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Fixed backward compat issue

This commit is contained in:
Adolfo Gómez García 2023-05-18 19:46:48 +02:00
parent e47831ebc2
commit f810fc1cd6
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -283,6 +283,24 @@ class UDSServerApi(UDSApi):
}
r = self._doPost('initialize', payload)
os = r['os']
# * TO BE REMOVED ON FUTURE VERSIONS *
# To keep compatibility, store old values on custom data
# This will be removed in future versions
# The values stored are:
# username=os.get('username'),
# password=os.get('password'),
# new_password=os.get('new_password'),
# domain=os.get('ad'),
# ou=os.get('ou'),
# So update custom data with this info
custom = os.get('custom', {})
for i in ('username', 'password', 'new_password', 'ad', 'ou'):
# ad is converted to domain
if i not in os:
continue # Skip if not present on os, do not overwrite custom
name = 'domain' if i == 'ad' else i
custom[name] = os[i] # os[i] is present, so force it on custom
return types.InitializationResultType(
own_token=r['own_token'],
unique_id=r['unique_id'].lower() if r['unique_id'] else None,