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
9ee92053
authored
Oct 27, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
views/node: allow list with vm.view_statistics perms
parent
3c8b525a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
circle/dashboard/views/node.py
+8
-3
No files found.
circle/dashboard/views/node.py
View file @
9ee92053
...
@@ -75,7 +75,7 @@ node_ops = OrderedDict([
...
@@ -75,7 +75,7 @@ node_ops = OrderedDict([
])
])
class
NodeDetailView
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
class
NodeDetailView
(
LoginRequiredMixin
,
GraphMixin
,
DetailView
):
GraphMixin
,
DetailView
):
template_name
=
"dashboard/node-detail.html"
template_name
=
"dashboard/node-detail.html"
model
=
Node
model
=
Node
...
@@ -83,6 +83,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
...
@@ -83,6 +83,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
form_class
=
TraitForm
form_class
=
TraitForm
def
get_context_data
(
self
,
form
=
None
,
**
kwargs
):
def
get_context_data
(
self
,
form
=
None
,
**
kwargs
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
if
form
is
None
:
if
form
is
None
:
form
=
self
.
form_class
()
form
=
self
.
form_class
()
context
=
super
(
NodeDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
NodeDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
...
@@ -98,6 +100,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
...
@@ -98,6 +100,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
return
context
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
not
request
.
user
.
is_superuser
:
raise
PermissionDenied
()
if
request
.
POST
.
get
(
'new_name'
):
if
request
.
POST
.
get
(
'new_name'
):
return
self
.
__set_name
(
request
)
return
self
.
__set_name
(
request
)
if
request
.
POST
.
get
(
'to_remove'
):
if
request
.
POST
.
get
(
'to_remove'
):
...
@@ -145,13 +149,14 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
...
@@ -145,13 +149,14 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
return
redirect
(
self
.
object
.
get_absolute_url
())
return
redirect
(
self
.
object
.
get_absolute_url
())
class
NodeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
class
NodeList
(
LoginRequiredMixin
,
GraphMixin
,
SingleTableView
):
GraphMixin
,
SingleTableView
):
template_name
=
"dashboard/node-list.html"
template_name
=
"dashboard/node-list.html"
table_class
=
NodeListTable
table_class
=
NodeListTable
table_pagination
=
False
table_pagination
=
False
def
get
(
self
,
*
args
,
**
kwargs
):
def
get
(
self
,
*
args
,
**
kwargs
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
if
self
.
request
.
is_ajax
():
if
self
.
request
.
is_ajax
():
nodes
=
Node
.
objects
.
all
()
nodes
=
Node
.
objects
.
all
()
nodes
=
[{
nodes
=
[{
...
...
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