mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
Merge pull request #1380 from raunz/preserve_history
Preserve domain records history after domain deletion
This commit is contained in:
commit
145358113d
@ -549,6 +549,7 @@ class Domain(db.Model):
|
|||||||
domain.apikeys[:] = []
|
domain.apikeys[:] = []
|
||||||
|
|
||||||
# Remove history for domain
|
# Remove history for domain
|
||||||
|
if not Setting().get('preserve_history'):
|
||||||
domain_history = History.query.filter(
|
domain_history = History.query.filter(
|
||||||
History.domain_id == domain.id
|
History.domain_id == domain.id
|
||||||
)
|
)
|
||||||
|
@ -31,6 +31,7 @@ class Setting(db.Model):
|
|||||||
'delete_sso_accounts': False,
|
'delete_sso_accounts': False,
|
||||||
'bg_domain_updates': False,
|
'bg_domain_updates': False,
|
||||||
'enable_api_rr_history': True,
|
'enable_api_rr_history': True,
|
||||||
|
'preserve_history': False,
|
||||||
'site_name': 'PowerDNS-Admin',
|
'site_name': 'PowerDNS-Admin',
|
||||||
'site_url': 'http://localhost:9191',
|
'site_url': 'http://localhost:9191',
|
||||||
'session_timeout': 10,
|
'session_timeout': 10,
|
||||||
|
@ -963,6 +963,13 @@ def history():
|
|||||||
'msg': 'You do not have permission to remove history.'
|
'msg': 'You do not have permission to remove history.'
|
||||||
}), 401)
|
}), 401)
|
||||||
|
|
||||||
|
if Setting().get('preserve_history'):
|
||||||
|
return make_response(
|
||||||
|
jsonify({
|
||||||
|
'status': 'error',
|
||||||
|
'msg': 'History removal is not allowed (toggle preserve_history in settings).'
|
||||||
|
}), 401)
|
||||||
|
|
||||||
h = History()
|
h = History()
|
||||||
result = h.remove_all()
|
result = h.remove_all()
|
||||||
if result:
|
if result:
|
||||||
@ -1318,6 +1325,7 @@ def setting_basic():
|
|||||||
'otp_field_enabled',
|
'otp_field_enabled',
|
||||||
'otp_force',
|
'otp_force',
|
||||||
'pdns_api_timeout',
|
'pdns_api_timeout',
|
||||||
|
'preserve_history',
|
||||||
'pretty_ipv6_ptr',
|
'pretty_ipv6_ptr',
|
||||||
'record_helper',
|
'record_helper',
|
||||||
'record_quick_edit',
|
'record_quick_edit',
|
||||||
|
Loading…
Reference in New Issue
Block a user