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
79c214d4
authored
Aug 27, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: no migrate button for regular users
parent
8f8c512d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
circle/dashboard/views.py
+15
-2
No files found.
circle/dashboard/views.py
View file @
79c214d4
...
@@ -1041,7 +1041,8 @@ class MassOperationView(OperationView):
...
@@ -1041,7 +1041,8 @@ class MassOperationView(OperationView):
return
ctx
return
ctx
def
check_auth
(
self
):
@classmethod
def
check_auth
(
self
,
user
=
None
):
pass
pass
def
get_object
(
self
):
def
get_object
(
self
):
...
@@ -1112,6 +1113,11 @@ class MassMigrationView(MassOperationView):
...
@@ -1112,6 +1113,11 @@ class MassMigrationView(MassOperationView):
icon
=
"truck"
icon
=
"truck"
effect
=
"info"
effect
=
"info"
@classmethod
def
check_auth
(
self
,
user
=
None
):
if
user
and
not
user
.
is_superuser
:
raise
PermissionDenied
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
MassMigrationView
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
=
super
(
MassMigrationView
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
[
'nodes'
]
=
[
n
for
n
in
Node
.
objects
.
filter
(
enabled
=
True
)
ctx
[
'nodes'
]
=
[
n
for
n
in
Node
.
objects
.
filter
(
enabled
=
True
)
...
@@ -1715,7 +1721,14 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
...
@@ -1715,7 +1721,14 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
(
VmList
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
context
=
super
(
VmList
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
context
[
'ops'
]
=
[
v
for
k
,
v
in
vm_mass_ops
.
iteritems
()]
context
[
'ops'
]
=
[]
for
k
,
v
in
vm_mass_ops
.
iteritems
():
try
:
v
.
check_auth
(
user
=
self
.
request
.
user
)
except
PermissionDenied
:
pass
else
:
context
[
'ops'
]
.
append
(
v
)
context
[
'search_form'
]
=
self
.
search_form
context
[
'search_form'
]
=
self
.
search_form
return
context
return
context
...
...
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