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:
SIPOS, Peter 2016-11-21 15:52:07 +01:00
parent 4ec70f4143
commit 1538cf0239
2 changed files with 8 additions and 3 deletions

View File

@ -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;

View File

@ -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))