From 02700ee7b0b53c7adb5b35f03efc6e4382cacd31 Mon Sep 17 00:00:00 2001 From: Rauno Tuul Date: Wed, 8 Feb 2023 17:03:35 +0200 Subject: [PATCH 1/3] Patch API record update/delete logging to match current logging format --- powerdnsadmin/routes/api.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/powerdnsadmin/routes/api.py b/powerdnsadmin/routes/api.py index 3df31e1..0844c32 100644 --- a/powerdnsadmin/routes/api.py +++ b/powerdnsadmin/routes/api.py @@ -1119,14 +1119,16 @@ def api_zone_forward(server_id, zone_id): if Setting().get('enable_api_rr_history'): if request.method in ['POST', 'PATCH']: data = request.get_json(force=True) - for rrset_data in data['rrsets']: - history = History(msg='{0} zone {1} record of {2}'.format( - rrset_data['changetype'].lower(), rrset_data['type'], - rrset_data['name'].rstrip('.')), - detail=json.dumps(data), - created_by=g.apikey.description, - domain_id=Domain().get_id_by_name(zone_id.rstrip('.'))) - history.add() + history = History( + msg='Apply record changes to domain {0}'.format(zone_id.rstrip('.')), + detail = json.dumps({ + 'domain': zone_id.rstrip('.'), + 'add_rrsets': list(filter(lambda r: r['changetype'] == "REPLACE", data['rrsets'])), + 'del_rrsets': list(filter(lambda r: r['changetype'] == "DELETE", data['rrsets'])) + }), + created_by=g.apikey.description, + domain_id=Domain().get_id_by_name(zone_id.rstrip('.'))) + history.add() elif request.method == 'DELETE': history = History(msg='Deleted zone {0}'.format(zone_id.rstrip('.')), detail='', From 187b55e23a2236593866dd4da31fad132372c80d Mon Sep 17 00:00:00 2001 From: Rauno Tuul Date: Wed, 8 Feb 2023 17:03:35 +0200 Subject: [PATCH 2/3] Patch API record update/delete logging to match current logging format --- powerdnsadmin/routes/api.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/powerdnsadmin/routes/api.py b/powerdnsadmin/routes/api.py index 3df31e1..0844c32 100644 --- a/powerdnsadmin/routes/api.py +++ b/powerdnsadmin/routes/api.py @@ -1119,14 +1119,16 @@ def api_zone_forward(server_id, zone_id): if Setting().get('enable_api_rr_history'): if request.method in ['POST', 'PATCH']: data = request.get_json(force=True) - for rrset_data in data['rrsets']: - history = History(msg='{0} zone {1} record of {2}'.format( - rrset_data['changetype'].lower(), rrset_data['type'], - rrset_data['name'].rstrip('.')), - detail=json.dumps(data), - created_by=g.apikey.description, - domain_id=Domain().get_id_by_name(zone_id.rstrip('.'))) - history.add() + history = History( + msg='Apply record changes to domain {0}'.format(zone_id.rstrip('.')), + detail = json.dumps({ + 'domain': zone_id.rstrip('.'), + 'add_rrsets': list(filter(lambda r: r['changetype'] == "REPLACE", data['rrsets'])), + 'del_rrsets': list(filter(lambda r: r['changetype'] == "DELETE", data['rrsets'])) + }), + created_by=g.apikey.description, + domain_id=Domain().get_id_by_name(zone_id.rstrip('.'))) + history.add() elif request.method == 'DELETE': history = History(msg='Deleted zone {0}'.format(zone_id.rstrip('.')), detail='', From 25dcc81e03244073760b5e197d4e656162801f77 Mon Sep 17 00:00:00 2001 From: ichisuke55 Date: Mon, 20 Feb 2023 23:22:25 +0900 Subject: [PATCH 3/3] fix: configurable CAPTCHA_ENABLE env when docker use --- configs/docker_config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/docker_config.py b/configs/docker_config.py index 42fffd5..174f93c 100644 --- a/configs/docker_config.py +++ b/configs/docker_config.py @@ -61,6 +61,7 @@ legal_envvars = ( 'FILESYSTEM_SESSIONS_ENABLED', 'SESSION_COOKIE_SECURE', 'CSRF_COOKIE_SECURE', + 'CAPTCHA_ENABLE', ) legal_envvars_int = ('PORT', 'MAIL_PORT', 'SAML_METADATA_CACHE_LIFETIME') @@ -84,6 +85,7 @@ legal_envvars_bool = ( 'FILESYSTEM_SESSIONS_ENABLED', 'SESSION_COOKIE_SECURE', 'CSRF_COOKIE_SECURE', + 'CAPTCHA_ENABLE', ) # import everything from environment variables