Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
...
@@ -26,7 +26,7 @@ from django.http import HttpResponse, Http404
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.views.generic
import
View
from
django.views.generic
import
View
from
braces.views
import
LoginRequiredMixin
,
SuperuserRequiredMixin
from
braces.views
import
LoginRequiredMixin
from
vm.models
import
Instance
,
Node
from
vm.models
import
Instance
,
Node
...
@@ -142,22 +142,28 @@ class VmGraphView(GraphViewBase):
...
@@ -142,22 +142,28 @@ class VmGraphView(GraphViewBase):
base
=
VmMetric
base
=
VmMetric
class
NodeGraphView
(
SuperuserRequiredMixin
,
GraphViewBase
):
class
NodeGraphView
(
GraphViewBase
):
model
=
Node
model
=
Node
base
=
NodeMetric
base
=
NodeMetric
def
get_object
(
self
,
request
,
pk
):
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
)
return
self
.
model
.
objects
.
get
(
id
=
pk
)
class
NodeListGraphView
(
SuperuserRequiredMixin
,
GraphViewBase
):
class
NodeListGraphView
(
GraphViewBase
):
model
=
Node
model
=
Node
base
=
Metric
base
=
Metric
def
get_object
(
self
,
request
,
pk
):
def
get_object
(
self
,
request
,
pk
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
return
Node
.
objects
.
filter
(
enabled
=
True
)
return
Node
.
objects
.
filter
(
enabled
=
True
)
def
get
(
self
,
request
,
metric
,
time
,
*
args
,
**
kwargs
):
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
)
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