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
9928686b
authored
Oct 27, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
views/graph: allow graph with vm.view_statistics perms
parent
30681e63
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
circle/dashboard/views/graph.py
+9
-3
No files found.
circle/dashboard/views/graph.py
View file @
9928686b
...
...
@@ -26,7 +26,7 @@ from django.http import HttpResponse, Http404
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.views.generic
import
View
from
braces.views
import
LoginRequiredMixin
,
SuperuserRequiredMixin
from
braces.views
import
LoginRequiredMixin
from
vm.models
import
Instance
,
Node
...
...
@@ -142,22 +142,28 @@ class VmGraphView(GraphViewBase):
base
=
VmMetric
class
NodeGraphView
(
SuperuserRequiredMixin
,
GraphViewBase
):
class
NodeGraphView
(
GraphViewBase
):
model
=
Node
base
=
NodeMetric
def
get_object
(
self
,
request
,
pk
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
return
self
.
model
.
objects
.
get
(
id
=
pk
)
class
NodeListGraphView
(
SuperuserRequiredMixin
,
GraphViewBase
):
class
NodeListGraphView
(
GraphViewBase
):
model
=
Node
base
=
Metric
def
get_object
(
self
,
request
,
pk
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
return
Node
.
objects
.
filter
(
enabled
=
True
)
def
get
(
self
,
request
,
metric
,
time
,
*
args
,
**
kwargs
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
return
super
(
NodeListGraphView
,
self
)
.
get
(
request
,
None
,
metric
,
time
)
...
...
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