Allow API requests for mnt-lower, too

This commit is contained in:
Sebastian Lohff 2017-10-11 13:55:09 +02:00
parent 27e1a35e5a
commit d6176d8756
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ def asblockFreeAS(request):
try:
mnts = request.user.maintainer_set.all()
block = ASBlock.objects.filter(mnt_by__in=mnts).distinct().get(handle=blockName)
block = ASBlock.objects.filter(Q(mnt_by__in=mnts) | Q(mnt_lower__in=mnts)).distinct().get(handle=blockName)
if block.asblock_set.count() > 0:
raise ValidationError("AS Block already has sub AS Blocks")
if block.asnumber_set.count() > 0:
@ -72,7 +72,7 @@ def freeSubnet(request):
parentRange = None
try:
mnts = request.user.maintainer_set.all()
parentRange = InetNum.objects.filter(mnt_by__in=mnts).distinct().get(handle=parentRangeName)
parentRange = InetNum.objects.filter(Q(mnt_by__in=mnts) | Q(mnt_lower__in=mnts)).distinct().get(handle=parentRangeName)
except InetNum.DoesNotExist:
raise ValidationError("Parent range does not exist / is not maintained by you")