From 337a75ef19ea0708ed40e173fcd81b1940f736a1 Mon Sep 17 00:00:00 2001 From: Romazes Date: Thu, 19 Sep 2024 02:28:09 +0300 Subject: [PATCH] refactor: update account_ids in AuthConfiguration feat: skip account ids if it is not provided --- lean/models/json_module.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lean/models/json_module.py b/lean/models/json_module.py index 46b4fc7a..001d6ae0 100644 --- a/lean/models/json_module.py +++ b/lean/models/json_module.py @@ -212,13 +212,16 @@ def config_build(self, auth_authorizations = get_authorization(container.api_client.auth0, self._display_name.lower(), logger) logger.debug(f'auth: {auth_authorizations}') configuration._value = auth_authorizations.authorization + for config in self._lean_configs: + if isinstance(config, AccountIdsConfiguration): + account_ids = auth_authorizations.accountIds + if account_ids and len(account_ids) > 0: + config._choices = account_ids + break + continue + elif (isinstance(configuration, AccountIdsConfiguration) and configuration._optional + and not configuration._choices): continue - elif isinstance(configuration, AccountIdsConfiguration): - account_ids = get_authorization(container.api_client.auth0, self._display_name.lower(), logger).accountIds - if account_ids and len(account_ids) > 0: - configuration._choices = account_ids - elif configuration._optional: - continue property_name = self.convert_lean_key_to_variable(configuration._id) # Only ask for user input if the config wasn't given as an option