Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dc717ea3
authored
Oct 16, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: allow cloning permissions of parent template
parent
a4d5963c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
circle/dashboard/forms.py
+6
-0
circle/dashboard/views/vm.py
+4
-0
No files found.
circle/dashboard/forms.py
View file @
dc717ea3
...
@@ -90,9 +90,15 @@ class VmSaveForm(OperationForm):
...
@@ -90,9 +90,15 @@ class VmSaveForm(OperationForm):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
default
=
kwargs
.
pop
(
'default'
,
None
)
default
=
kwargs
.
pop
(
'default'
,
None
)
clone
=
kwargs
.
pop
(
'clone'
,
False
)
super
(
VmSaveForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
VmSaveForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
if
default
:
if
default
:
self
.
fields
[
'name'
]
.
initial
=
default
self
.
fields
[
'name'
]
.
initial
=
default
if
clone
:
self
.
fields
.
insert
(
2
,
"clone"
,
forms
.
BooleanField
(
required
=
False
,
label
=
_
(
"Clone template permissions"
),
help_text
=
_
(
"Clone the access list of parent template. Useful "
"for updating a template."
)))
class
VmCustomizeForm
(
forms
.
Form
):
class
VmCustomizeForm
(
forms
.
Form
):
...
...
circle/dashboard/views/vm.py
View file @
dc717ea3
...
@@ -457,6 +457,10 @@ class VmSaveView(FormOperationMixin, VmOperationView):
...
@@ -457,6 +457,10 @@ class VmSaveView(FormOperationMixin, VmOperationView):
op
=
self
.
get_op
()
op
=
self
.
get_op
()
val
=
super
(
VmSaveView
,
self
)
.
get_form_kwargs
()
val
=
super
(
VmSaveView
,
self
)
.
get_form_kwargs
()
val
[
'default'
]
=
op
.
_rename
(
op
.
instance
.
name
)
val
[
'default'
]
=
op
.
_rename
(
op
.
instance
.
name
)
obj
=
self
.
get_object
()
if
obj
.
template
and
obj
.
template
.
has_level
(
self
.
request
.
user
,
"owner"
):
val
[
'clone'
]
=
True
return
val
return
val
...
...
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