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
44bd096f
authored
Dec 06, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add permissions to Instance
parent
16213292
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
circle/dashboard/views.py
+4
-0
circle/vm/models/instance.py
+6
-0
No files found.
circle/dashboard/views.py
View file @
44bd096f
...
@@ -127,6 +127,8 @@ class VmDetailView(CheckedDetailView):
...
@@ -127,6 +127,8 @@ class VmDetailView(CheckedDetailView):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
raise
PermissionDenied
()
if
not
request
.
user
.
has_perm
(
'vm.change_resources'
):
raise
PermissionDenied
()
resources
=
{
resources
=
{
'num_cores'
:
request
.
POST
.
get
(
'cpu-count'
),
'num_cores'
:
request
.
POST
.
get
(
'cpu-count'
),
...
@@ -208,6 +210,8 @@ class VmDetailView(CheckedDetailView):
...
@@ -208,6 +210,8 @@ class VmDetailView(CheckedDetailView):
object
=
self
.
get_object
()
object
=
self
.
get_object
()
if
not
object
.
has_level
(
request
.
user
,
'owner'
):
if
not
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
raise
PermissionDenied
()
if
not
request
.
user
.
has_perm
(
'vm.config_ports'
):
raise
PermissionDenied
()
port
=
request
.
POST
.
get
(
"port"
)
port
=
request
.
POST
.
get
(
"port"
)
proto
=
request
.
POST
.
get
(
"proto"
)
proto
=
request
.
POST
.
get
(
"proto"
)
...
...
circle/vm/models/instance.py
View file @
44bd096f
...
@@ -215,6 +215,12 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -215,6 +215,12 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
app_label
=
'vm'
app_label
=
'vm'
db_table
=
'vm_instance'
db_table
=
'vm_instance'
ordering
=
[
'pk'
,
]
ordering
=
[
'pk'
,
]
permissions
=
(
(
'access_console'
,
_
(
'Can access the graphical console of a VM.'
)),
(
'change_resources'
,
_
(
'Can change resources of a running VM.'
)),
(
'set_resources'
,
_
(
'Can change resources of a new VM.'
)),
(
'config_ports'
,
_
(
'Can configure port forwards.'
)),
)
verbose_name
=
_
(
'instance'
)
verbose_name
=
_
(
'instance'
)
verbose_name_plural
=
_
(
'instances'
)
verbose_name_plural
=
_
(
'instances'
)
...
...
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