Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b0eb77fb
authored
Dec 03, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
occi: raise permission denied if user can't create disk
parent
d3987543
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
circle/occi/occi.py
+0
-1
circle/occi/views.py
+8
-1
No files found.
circle/occi/occi.py
View file @
b0eb77fb
import
re
import
re
import
logging
import
logging
from
django.contrib.auth.models
import
User
from
django.template.loader
import
render_to_string
from
django.template.loader
import
render_to_string
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.utils.formats
import
date_format
from
django.utils.formats
import
date_format
...
...
circle/occi/views.py
View file @
b0eb77fb
...
@@ -41,6 +41,9 @@ class CSRFExemptMixin(object):
...
@@ -41,6 +41,9 @@ class CSRFExemptMixin(object):
return
super
(
CSRFExemptMixin
,
self
)
.
dispatch
(
*
args
,
**
kwargs
)
return
super
(
CSRFExemptMixin
,
self
)
.
dispatch
(
*
args
,
**
kwargs
)
except
HumanReadableException
as
e
:
except
HumanReadableException
as
e
:
return
HttpResponse
(
e
.
get_user_text
(),
status
=
400
)
return
HttpResponse
(
e
.
get_user_text
(),
status
=
400
)
except
PermissionDenied
as
e
:
return
HttpResponse
(
""
,
status
=
401
)
class
OCCIPostDataAsListMixin
(
object
):
class
OCCIPostDataAsListMixin
(
object
):
...
@@ -103,7 +106,8 @@ class QueryInterface(CSRFExemptMixin, View):
...
@@ -103,7 +106,8 @@ class QueryInterface(CSRFExemptMixin, View):
class
ComputeInterface
(
CSRFExemptMixin
,
OCCIPostDataAsListMixin
,
View
):
class
ComputeInterface
(
CSRFExemptMixin
,
OCCIPostDataAsListMixin
,
View
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
vms
=
Instance
.
get_objects_with_level
(
"user"
,
self
.
request
.
user
)
vms
=
Instance
.
get_objects_with_level
(
"user"
,
self
.
request
.
user
)
.
filter
(
destroyed_at
=
None
)
response
=
"
\n
"
.
join
([
Compute
(
instance
=
i
)
.
render_location
()
response
=
"
\n
"
.
join
([
Compute
(
instance
=
i
)
.
render_location
()
for
i
in
vms
])
for
i
in
vms
])
return
HttpResponse
(
return
HttpResponse
(
...
@@ -183,6 +187,9 @@ class StorageInterface(CSRFExemptMixin, OCCIPostDataAsListMixin, View):
...
@@ -183,6 +187,9 @@ class StorageInterface(CSRFExemptMixin, OCCIPostDataAsListMixin, View):
)
)
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
not
self
.
request
.
user
.
has_perm
(
"storage.create_empty_disk"
):
raise
PermissionDenied
data
=
self
.
get_post_data
(
request
)
data
=
self
.
get_post_data
(
request
)
d
=
Storage
.
create_object
(
data
=
data
,
user
=
self
.
request
.
user
)
d
=
Storage
.
create_object
(
data
=
data
,
user
=
self
.
request
.
user
)
...
...
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