Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0ae68ec4
authored
May 05, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add network acl to templates
parent
fdb2cc34
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
circle/dashboard/views.py
+8
-2
No files found.
circle/dashboard/views.py
View file @
0ae68ec4
...
@@ -936,7 +936,8 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
...
@@ -936,7 +936,8 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
else
:
else
:
post
=
form
.
cleaned_data
post
=
form
.
cleaned_data
networks
=
self
.
__create_networks
(
post
.
pop
(
"networks"
))
networks
=
self
.
__create_networks
(
post
.
pop
(
"networks"
),
request
.
user
)
post
.
pop
(
"parent"
)
post
.
pop
(
"parent"
)
parent_type
=
post
.
pop
(
"parent_type"
)
parent_type
=
post
.
pop
(
"parent_type"
)
post
[
'max_ram_size'
]
=
post
[
'ram_size'
]
post
[
'max_ram_size'
]
=
post
[
'ram_size'
]
...
@@ -970,9 +971,11 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
...
@@ -970,9 +971,11 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
return
super
(
TemplateCreate
,
self
)
.
post
(
self
,
request
,
args
,
kwargs
)
return
super
(
TemplateCreate
,
self
)
.
post
(
self
,
request
,
args
,
kwargs
)
def
__create_networks
(
self
,
vlans
):
def
__create_networks
(
self
,
vlans
,
user
):
networks
=
[]
networks
=
[]
for
v
in
vlans
:
for
v
in
vlans
:
if
not
v
.
has_level
(
user
,
"user"
):
raise
PermissionDenied
()
networks
.
append
(
InterfaceTemplate
(
vlan
=
v
,
managed
=
v
.
managed
))
networks
.
append
(
InterfaceTemplate
(
vlan
=
v
,
managed
=
v
.
managed
))
return
networks
return
networks
...
@@ -1037,6 +1040,9 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
...
@@ -1037,6 +1040,9 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
for
disk
in
self
.
get_object
()
.
disks
.
all
():
for
disk
in
self
.
get_object
()
.
disks
.
all
():
if
not
disk
.
has_level
(
request
.
user
,
'user'
):
if
not
disk
.
has_level
(
request
.
user
,
'user'
):
raise
PermissionDenied
()
raise
PermissionDenied
()
for
network
in
self
.
get_object
()
.
interface_set
.
all
():
if
not
network
.
vlan
.
has_level
(
request
.
user
,
"user"
):
raise
PermissionDenied
()
return
super
(
TemplateDetail
,
self
)
.
post
(
self
,
request
,
args
,
kwargs
)
return
super
(
TemplateDetail
,
self
)
.
post
(
self
,
request
,
args
,
kwargs
)
def
get_form_kwargs
(
self
):
def
get_form_kwargs
(
self
):
...
...
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