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
29cd55f7
authored
Aug 18, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: calculate objects of user only once
parent
8a8b4bbd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
circle/dashboard/views.py
+6
-2
No files found.
circle/dashboard/views.py
View file @
29cd55f7
...
@@ -1004,6 +1004,11 @@ class MassOperationView(OperationView):
...
@@ -1004,6 +1004,11 @@ class MassOperationView(OperationView):
else
:
else
:
return
Instance
.
_ops
[
self
.
op
]
return
Instance
.
_ops
[
self
.
op
]
def
dispatch
(
self
,
*
args
,
**
kwargs
):
user
=
self
.
request
.
user
self
.
objects_of_user
=
Instance
.
get_objects_with_level
(
"user"
,
user
)
return
super
(
MassOperationView
,
self
)
.
dispatch
(
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
MassOperationView
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
=
super
(
MassOperationView
,
self
)
.
get_context_data
(
**
kwargs
)
instances
=
self
.
request
.
GET
.
getlist
(
"vm"
)
instances
=
self
.
request
.
GET
.
getlist
(
"vm"
)
...
@@ -1060,8 +1065,7 @@ class MassOperationView(OperationView):
...
@@ -1060,8 +1065,7 @@ class MassOperationView(OperationView):
return
redirect
(
reverse
(
"dashboard.views.vm-list"
))
return
redirect
(
reverse
(
"dashboard.views.vm-list"
))
def
_op_checks
(
self
,
instance
,
user
):
def
_op_checks
(
self
,
instance
,
user
):
objects_of_user
=
Instance
.
get_objects_with_level
(
"user"
,
user
)
if
instance
not
in
self
.
objects_of_user
:
if
instance
not
in
objects_of_user
:
raise
SuspiciousOperation
()
raise
SuspiciousOperation
()
op
=
self
.
get_op
(
instance
)
op
=
self
.
get_op
(
instance
)
op
.
check_auth
(
user
)
op
.
check_auth
(
user
)
...
...
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