mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-14 09:30:27 +00:00
Limit record selection in reverse lookup domain to PTR
And also fix the default type selection of a new record
This commit is contained in:
parent
4ec70f4143
commit
1538cf0239
@ -223,7 +223,8 @@
|
|||||||
$("#tbl_records").DataTable().search('').columns().search('').draw();
|
$("#tbl_records").DataTable().search('').columns().search('').draw();
|
||||||
|
|
||||||
// add new row
|
// add new row
|
||||||
var nRow = jQuery('#tbl_records').dataTable().fnAddData(['', 'A', 'Active', 3600, '', '', '', '0']);
|
var default_type = records_allow_edit[0]
|
||||||
|
var nRow = jQuery('#tbl_records').dataTable().fnAddData(['', default_type, 'Active', 3600, '', '', '', '0']);
|
||||||
editRow($("#tbl_records").DataTable(), nRow);
|
editRow($("#tbl_records").DataTable(), nRow);
|
||||||
document.getElementById("edit-row-focus").focus();
|
document.getElementById("edit-row-focus").focus();
|
||||||
nEditing = nRow;
|
nEditing = nRow;
|
||||||
|
@ -2,6 +2,7 @@ import base64
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
import re
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
@ -317,8 +318,11 @@ def domain(domain_name):
|
|||||||
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
|
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
|
||||||
record = Record(name=jr['name'], type=jr['type'], status='Disabled' if jr['disabled'] else 'Active', ttl=jr['ttl'], data=jr['content'])
|
record = Record(name=jr['name'], type=jr['type'], status='Disabled' if jr['disabled'] else 'Active', ttl=jr['ttl'], data=jr['content'])
|
||||||
records.append(record)
|
records.append(record)
|
||||||
|
if not re.search('ip6\.arpa|in-addr\.arpa$', domain_name):
|
||||||
return render_template('domain.html', domain=domain, records=records, editable_records=app.config['RECORDS_ALLOW_EDIT'])
|
editable_records = app.config['RECORDS_ALLOW_EDIT']
|
||||||
|
else:
|
||||||
|
editable_records = ['PTR']
|
||||||
|
return render_template('domain.html', domain=domain, records=records, editable_records=editable_records)
|
||||||
else:
|
else:
|
||||||
return redirect(url_for('error', code=404))
|
return redirect(url_for('error', code=404))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user