Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
a5b12a9a
Commit
a5b12a9a
authored
Jul 27, 2012
by
Christos Stavrakakis
Browse files
Limit allowed private networks per user
parent
026ec94a
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/api/networks.py
View file @
a5b12a9a
...
...
@@ -172,6 +172,10 @@ def create_network(request):
if
typ
==
'PUBLIC_ROUTED'
:
raise
Unauthorized
(
'Can not create a public network.'
)
user_networks
=
len
(
Network
.
objects
.
filter
(
userid
=
request
.
user_uniq
))
if
user_networks
>
settings
.
MAX_NETWORKS_PER_USER
:
raise
OverLimit
(
'Network count limit exceeded for your account.'
)
cidr_block
=
int
(
subnet
.
split
(
'/'
)[
1
])
if
cidr_block
<=
MAX_CIDR_BLOCK
:
raise
OverLimit
(
"Network size is to big. Please specify a network"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment