Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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([
])
class
NodeDetailView
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
class
NodeDetailView
(
LoginRequiredMixin
,
GraphMixin
,
DetailView
):
template_name
=
"dashboard/node-detail.html"
model
=
Node
...
...
@@ -83,6 +83,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
form_class
=
TraitForm
def
get_context_data
(
self
,
form
=
None
,
**
kwargs
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
if
form
is
None
:
form
=
self
.
form_class
()
context
=
super
(
NodeDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
@@ -98,6 +100,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
not
request
.
user
.
is_superuser
:
raise
PermissionDenied
()
if
request
.
POST
.
get
(
'new_name'
):
return
self
.
__set_name
(
request
)
if
request
.
POST
.
get
(
'to_remove'
):
...
...
@@ -145,13 +149,14 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin,
return
redirect
(
self
.
object
.
get_absolute_url
())
class
NodeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
GraphMixin
,
SingleTableView
):
class
NodeList
(
LoginRequiredMixin
,
GraphMixin
,
SingleTableView
):
template_name
=
"dashboard/node-list.html"
table_class
=
NodeListTable
table_pagination
=
False
def
get
(
self
,
*
args
,
**
kwargs
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
if
self
.
request
.
is_ajax
():
nodes
=
Node
.
objects
.
all
()
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