From a78b6a89d273a1d94d97aa24c445a8984451edde Mon Sep 17 00:00:00 2001 From: himeshsiriwardana Date: Wed, 4 Dec 2024 15:09:57 +0530 Subject: [PATCH 1/2] if env variable is not set, conditions will be true --- .../docs/references/user-management/user-roles.md | 2 +- en/asgardeo/hooks.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/en/asgardeo/docs/references/user-management/user-roles.md b/en/asgardeo/docs/references/user-management/user-roles.md index bce26cb5ea..44f4b51f7d 100644 --- a/en/asgardeo/docs/references/user-management/user-roles.md +++ b/en/asgardeo/docs/references/user-management/user-roles.md @@ -1,4 +1,4 @@ -{% if default_roles == true %} +{% if default_roles %} # Asgardeo user roles diff --git a/en/asgardeo/hooks.py b/en/asgardeo/hooks.py index 17b045c0c1..e05b64a928 100644 --- a/en/asgardeo/hooks.py +++ b/en/asgardeo/hooks.py @@ -46,9 +46,14 @@ def remove_nav_item(nav_items): return filtered_items def on_config(config): - if os.getenv("ENABLE_HOOKS") == "true": - for feature, enabled in files_to_remove['feature'].items(): - config[feature] = enabled - + enable_hooks = os.getenv("ENABLE_HOOKS") + print("ENABLE HOOKS IS: " + str(enable_hooks)) + + for feature, enabled in files_to_remove['feature'].items(): + config[feature] = enabled if enable_hooks else True + + + if enable_hooks: config['nav'] = remove_nav_item(config['nav']) - return config + + return config From 310057f4f200d9519b535767dea5bf0f33709b3e Mon Sep 17 00:00:00 2001 From: himeshsiriwardana Date: Wed, 4 Dec 2024 15:11:10 +0530 Subject: [PATCH 2/2] remove print statement --- en/asgardeo/hooks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/en/asgardeo/hooks.py b/en/asgardeo/hooks.py index e05b64a928..f2e5708532 100644 --- a/en/asgardeo/hooks.py +++ b/en/asgardeo/hooks.py @@ -47,7 +47,6 @@ def remove_nav_item(nav_items): def on_config(config): enable_hooks = os.getenv("ENABLE_HOOKS") - print("ENABLE HOOKS IS: " + str(enable_hooks)) for feature, enabled in files_to_remove['feature'].items(): config[feature] = enabled if enable_hooks else True