Skip to content

Commit

Permalink
refactor: update account_ids in AuthConfiguration
Browse files Browse the repository at this point in the history
feat: skip account ids if it is not provided
  • Loading branch information
Romazes committed Sep 18, 2024
1 parent ee6a5bb commit 337a75e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lean/models/json_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 337a75e

Please sign in to comment.