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
484ed29e
authored
Apr 03, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add initial Requests views with permission check
parent
46d06df9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
9 deletions
+22
-9
.idea/workspace.xml
+0
-0
circle/circle/settings/base.py
+1
-0
circle/dashboard/templates/dashboard/index-vm.html
+1
-1
circle/request/views.py
+20
-8
No files found.
.idea/workspace.xml
View file @
484ed29e
This diff is collapsed.
Click to expand it.
circle/circle/settings/base.py
View file @
484ed29e
...
...
@@ -315,6 +315,7 @@ TEMPLATES = [{
'django.template.context_processors.media'
,
'django.template.context_processors.static'
,
'django.template.context_processors.tz'
,
'django.template.context_processors.request'
,
'django.contrib.messages.context_processors.messages'
,
'dashboard.context_processors.notifications'
,
'dashboard.context_processors.extract_settings'
,
...
...
circle/dashboard/templates/dashboard/index-vm.html
View file @
484ed29e
...
...
@@ -89,7 +89,7 @@
</div>
<div
class=
"panel-body"
id=
"vm-graph-view"
style=
"display: none"
>
<p
class=
"pull-right"
>
<input
class=
"knob"
data-fgColor=
"chartreuse"
data-thickness=
".4"
data-max=
"
{{ request.user.profile.instance_limit }}
"
data-width=
"100"
data-height=
"100"
data-readOnly=
"true"
value=
"{{ instances|length|add:more_instances }}"
>
<input
class=
"knob"
data-fgColor=
"chartreuse"
data-thickness=
".4"
data-max=
"
#TODO
"
data-width=
"100"
data-height=
"100"
data-readOnly=
"true"
value=
"{{ instances|length|add:more_instances }}"
>
</p>
<span
class=
"bigbig"
>
{% blocktrans with count=running_vm_num %}
<span
class=
"big-tag"
>
{{ count }}
</span>
running{% endblocktrans %}
</span>
<ul
class=
"list-inline"
style=
"max-height: 95px; overflow: hidden;"
>
...
...
circle/request/views.py
View file @
484ed29e
...
...
@@ -16,6 +16,7 @@
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
unicode_literals
,
absolute_import
from
braces.views._access
import
AccessMixin
from
django.views.generic
import
(
UpdateView
,
TemplateView
,
DetailView
,
CreateView
,
FormView
,
DeleteView
,
)
...
...
@@ -45,7 +46,18 @@ from request.forms import (
)
class
RequestList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
class
RequestDecideRequiredMixin
(
AccessMixin
):
"""
Mixin allows you to require a user with `is_superuser` set to True.
"""
def
dispatch
(
self
,
request
,
*
args
,
**
kwargs
):
if
not
self
.
request
.
user
.
permissions
[
"request_decide"
]:
return
self
.
handle_no_permission
(
request
)
return
super
(
RequestDecideRequiredMixin
,
self
)
.
dispatch
(
request
,
*
args
,
**
kwargs
)
class
RequestList
(
LoginRequiredMixin
,
RequestDecideRequiredMixin
,
SingleTableView
):
model
=
Request
table_class
=
RequestTable
template_name
=
"request/list.html"
...
...
@@ -102,7 +114,7 @@ class RequestDetail(LoginRequiredMixin, DetailView):
return
context
class
TemplateAccessTypeDetail
(
LoginRequiredMixin
,
Superuser
RequiredMixin
,
class
TemplateAccessTypeDetail
(
LoginRequiredMixin
,
RequestDecide
RequiredMixin
,
SuccessMessageMixin
,
UpdateView
):
model
=
TemplateAccessType
template_name
=
"request/template-type-form.html"
...
...
@@ -110,7 +122,7 @@ class TemplateAccessTypeDetail(LoginRequiredMixin, SuperuserRequiredMixin,
success_message
=
_
(
"Template access type successfully updated."
)
class
TemplateAccessTypeCreate
(
LoginRequiredMixin
,
Superuser
RequiredMixin
,
class
TemplateAccessTypeCreate
(
LoginRequiredMixin
,
RequestDecide
RequiredMixin
,
SuccessMessageMixin
,
CreateView
):
model
=
TemplateAccessType
template_name
=
"request/template-type-form.html"
...
...
@@ -118,7 +130,7 @@ class TemplateAccessTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin,
success_message
=
_
(
"New template access type successfully created."
)
class
TemplateAccessTypeDelete
(
LoginRequiredMixin
,
Superuser
RequiredMixin
,
class
TemplateAccessTypeDelete
(
LoginRequiredMixin
,
RequestDecide
RequiredMixin
,
DeleteView
):
model
=
TemplateAccessType
template_name
=
"dashboard/confirm/base-delete.html"
...
...
@@ -127,7 +139,7 @@ class TemplateAccessTypeDelete(LoginRequiredMixin, SuperuserRequiredMixin,
return
reverse
(
"request.views.type-list"
)
class
LeaseTypeDetail
(
LoginRequiredMixin
,
Superuser
RequiredMixin
,
class
LeaseTypeDetail
(
LoginRequiredMixin
,
RequestDecide
RequiredMixin
,
SuccessMessageMixin
,
UpdateView
):
model
=
LeaseType
template_name
=
"request/lease-type-form.html"
...
...
@@ -135,7 +147,7 @@ class LeaseTypeDetail(LoginRequiredMixin, SuperuserRequiredMixin,
success_message
=
_
(
"Lease type successfully updated."
)
class
LeaseTypeCreate
(
LoginRequiredMixin
,
Superuser
RequiredMixin
,
class
LeaseTypeCreate
(
LoginRequiredMixin
,
RequestDecide
RequiredMixin
,
SuccessMessageMixin
,
CreateView
):
model
=
LeaseType
template_name
=
"request/lease-type-form.html"
...
...
@@ -143,7 +155,7 @@ class LeaseTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin,
success_message
=
_
(
"New lease type successfully created."
)
class
LeaseTypeDelete
(
LoginRequiredMixin
,
Superuser
RequiredMixin
,
DeleteView
):
class
LeaseTypeDelete
(
LoginRequiredMixin
,
RequestDecide
RequiredMixin
,
DeleteView
):
model
=
LeaseType
template_name
=
"dashboard/confirm/base-delete.html"
...
...
@@ -151,7 +163,7 @@ class LeaseTypeDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
return
reverse
(
"request.views.type-list"
)
class
RequestTypeList
(
LoginRequiredMixin
,
Superuser
RequiredMixin
,
class
RequestTypeList
(
LoginRequiredMixin
,
RequestDecide
RequiredMixin
,
TemplateView
):
template_name
=
"request/type-list.html"
...
...
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