Commit 1ca0df3c authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Use the per-user network limit setting

parent 8cb461c5
......@@ -182,10 +182,14 @@ def create_network(request):
if net_type not in settings.ENABLED_NETWORKS:
raise Forbidden("Can not create %s network" % net_type)
networks_user_limit = \
user_networks = len(Network.objects.filter(userid=request.user_uniq,
if user_networks >= settings.MAX_NETWORKS_PER_USER:
if user_networks >= networks_user_limit:
raise OverLimit('Network count limit exceeded for your account.')
cidr_block = int(subnet.split('/')[1])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment