Optimized nginx CSP (prop. leads to problems due to too high restrictions for some roles) and implemented health check for mailer

This commit is contained in:
2025-04-30 08:19:27 +02:00
parent 858cc770ec
commit 9575ee31ff
41 changed files with 224 additions and 113 deletions

View File

@@ -1,37 +1,10 @@
def get_oauth2_enabled(applications, application_id):
# Retrieve the application dictionary based on the ID
def is_feature_enabled(applications, feature:str, application_id:str)->bool:
app = applications.get(application_id, {})
# Retrieve the value for oauth2_proxy.enabled, default is False
enabled = app.get('features', {}).get('oauth2', False)
enabled = app.get('features', {}).get(feature, False)
return bool(enabled)
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('features', {}).get('oidc', False)
return bool(enabled)
def get_features_iframe(applications, application_id):
app = applications.get(application_id, {})
enabled = app.get('features', {}).get('iframe', False)
return bool(enabled)
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'].
If not defined, None is returned.
"""
app = applications.get(application_id, {})
db_type = app.get('features', {}).get('database', False)
return db_type
class FilterModule(object):
def filters(self):
return {
'get_oidc_enabled': get_oidc_enabled,
'get_oauth2_enabled': get_oauth2_enabled,
'get_database_central_storage': get_database_central_storage,
'get_features_iframe': get_features_iframe,
'is_feature_enabled': is_feature_enabled,
}