1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00

Support 202106 (#994)

* fixes #965: intermittent bug during consolidation of notifications

* fixes #863: better visibility for input validation errors

* fixes #375: re-evaluate affiliation requests on email change

* fixes #741: remove data quality validation for superusers

* fixes #587: customizable pagination in django admin

* fixes #923: Prevent deletion of a last technical contact if there is an existing netixlan object

* better search #23 (first pass)

* black format

* haystack test config to run_tests.py
remove old django_init.py test settings

* black format

* haystack test config fixes

* #23 better search (pt.2)

* rate limit distance queries (#23)
rate limiting based on query filters

* settings controlled blocking of distance filter for unauthenticated / unverified users (#23)

* fix distance filter throttling with api key auth (#23)

* fix anon user access check on distance queries

* search index and performance tweaks

* fix org_id not set in search results

* org id to int

Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
Matt Griswold
2021-07-07 17:57:04 -05:00
committed by GitHub
parent 9f74fb8a11
commit 7c3d160dec
51 changed files with 1853 additions and 784 deletions

View File

@@ -10,6 +10,7 @@ from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from peeringdb_server.inet import network_is_pdb_valid, IRR_SOURCE
from peeringdb_server.request import bypass_validation
import peeringdb_server.models
@@ -103,6 +104,10 @@ def validate_address_space(prefix):
if not network_is_pdb_valid(prefix):
raise ValidationError(_("Address space invalid: {}").format(prefix))
# bypass validation according to #741
if bypass_validation():
return
prefixlen_min = getattr(settings, f"DATA_QUALITY_MIN_PREFIXLEN_V{prefix.version}")
prefixlen_max = getattr(settings, f"DATA_QUALITY_MAX_PREFIXLEN_V{prefix.version}")
@@ -119,20 +124,36 @@ def validate_address_space(prefix):
def validate_info_prefixes4(value):
if not value:
value = 0
if value < 0:
raise ValidationError(_("Negative value not allowed"))
# bypass validation according to #741
if bypass_validation():
return value
if value > settings.DATA_QUALITY_MAX_PREFIX_V4_LIMIT:
raise ValidationError(
_("Maximum value allowed {}").format(
settings.DATA_QUALITY_MAX_PREFIX_V4_LIMIT
)
)
if value < 0:
raise ValidationError(_("Negative value not allowed"))
return value
def validate_info_prefixes6(value):
if not value:
value = 0
if value < 0:
raise ValidationError(_("Negative value not allowed"))
# bypass validation according to #741
if bypass_validation():
return value
if value > settings.DATA_QUALITY_MAX_PREFIX_V6_LIMIT:
raise ValidationError(
_("Maximum value allowed {}").format(
@@ -140,8 +161,6 @@ def validate_info_prefixes6(value):
)
)
if value < 0:
raise ValidationError(_("Negative value not allowed"))
return value
@@ -236,7 +255,11 @@ def validate_irr_as_set(value):
# validate set name and as hierarchy
as_parts = as_set.split(":")
if len(as_parts) > settings.DATA_QUALITY_MAX_IRR_DEPTH:
# validate max depth (superusers are allowed to bypass this validation, see #741)
if (
len(as_parts) > settings.DATA_QUALITY_MAX_IRR_DEPTH
and not bypass_validation()
):
raise ValidationError(
_("Maximum AS-SET hierarchy depth: {}").format(
settings.DATA_QUALITY_MAX_IRR_DEPTH