Implemented more detailed configuration for landing_page, css and matomo and restructured code

This commit is contained in:
2025-03-19 20:26:43 +01:00
parent f23850068a
commit 72693e09e2
12 changed files with 277 additions and 159 deletions

View File

@@ -1,25 +1,35 @@
def get_oauth2_enabled(applications, application_id):
import yaml
def get_oauth2_enabled(applications:yaml, application_id:string):
# Retrieve the application dictionary based on the ID
app = applications.get(application_id, {})
# Retrieve the value for oauth2_proxy.enabled, default is False
enabled = app.get('oauth2_proxy', {}).get('enabled', False)
return bool(enabled)
def get_oidc_enabled(applications, application_id):
def get_oidc_enabled(applications:yaml, application_id:string):
# Retrieve the application dictionary based on the ID
app = applications.get(application_id, {})
# Retrieve the value for oidc.enabled, default is False
enabled = app.get('oidc', {}).get('enabled', False)
return bool(enabled)
def get_css_enabled(applications, application_id):
# Retrieve the application dictionary based on the given application_id.
app = applications.get(application_id, {})
# Retrieve the 'enabled' value from the css key, defaulting to True if not present.
enabled = app.get('css', {}).get('enabled', True)
def get_css_enabled(applications:yaml, application_id:string):
app = applications.get(application_id)
enabled = app.get('css_enabled')
return bool(enabled)
def get_database_central_storage(applications, application_id):
def get_landingpage_iframe_enabled(applications:yaml, application_id:string):
app = applications.get(application_id)
enabled = app.get('landingpage_iframe_enabled')
return bool(enabled)
def get_matomo_tracking_enabled(applications:yaml, application_id:string):
app = applications.get(application_id)
enabled = app.get('matomo_tracking_enabled')
return bool(enabled)
def get_database_central_storage(applications:yaml, application_id:string):
"""
Retrieve the type of the database from the application dictionary.
The expected key structure is: applications[application_id]['database']['central_storage'].
@@ -36,4 +46,6 @@ class FilterModule(object):
'get_oidc_enabled': get_oidc_enabled,
'get_oauth2_enabled': get_oauth2_enabled,
'get_database_central_storage': get_database_central_storage,
'get_landingpage_iframe_enabled': get_landingpage_iframe_enabled,
'get_matomo_tracking_enabled': get_matomo_tracking_enabled,
}