Big cleanup

This commit is contained in:
2025-03-20 02:20:00 +01:00
parent 6520350731
commit 836a3e0238
22 changed files with 91 additions and 66 deletions

View File

@@ -1,35 +1,23 @@
import yaml
def get_oauth2_enabled(applications:yaml, application_id:string):
def get_oauth22_enabled(applications, application_id):
# 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:yaml, application_id:string):
def get_oidc_enabled(applications, application_id):
# 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:yaml, application_id:string):
app = applications.get(application_id)
enabled = app.get('css_enabled')
return bool(enabled)
def get_landingpage_iframe_enabled(applications:yaml, application_id:string):
def get_landingpage_iframe_enabled(applications, application_id):
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):
def get_database_central_storage(applications, application_id):
"""
Retrieve the type of the database from the application dictionary.
The expected key structure is: applications[application_id]['database']['central_storage'].
@@ -42,10 +30,8 @@ def get_database_central_storage(applications:yaml, application_id:string):
class FilterModule(object):
def filters(self):
return {
'get_css_enabled': get_css_enabled,
'get_oidc_enabled': get_oidc_enabled,
'get_oauth2_enabled': get_oauth2_enabled,
'get_oauth2_enabled': get_oauth22_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,
}