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
13bfd1ff
authored
Aug 28, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: do basic ownership auth for mass ops
parent
71b3d176
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
circle/dashboard/views.py
+11
-2
No files found.
circle/dashboard/views.py
View file @
13bfd1ff
...
@@ -1024,7 +1024,10 @@ class MassOperationView(OperationView):
...
@@ -1024,7 +1024,10 @@ class MassOperationView(OperationView):
template_name
=
'dashboard/mass-operate.html'
template_name
=
'dashboard/mass-operate.html'
def
check_auth
(
self
):
def
check_auth
(
self
):
pass
# OperationView.get calls this
for
i
in
self
.
get_object
():
if
not
i
.
has_level
(
self
.
request
.
user
,
"user"
):
raise
PermissionDenied
(
"You have no user access to instance
%
d"
%
i
.
pk
)
@classmethod
@classmethod
def
get_urlname
(
cls
):
def
get_urlname
(
cls
):
...
@@ -1075,13 +1078,19 @@ class MassOperationView(OperationView):
...
@@ -1075,13 +1078,19 @@ class MassOperationView(OperationView):
op
=
self
.
get_op
(
i
)
op
=
self
.
get_op
(
i
)
op
.
check_auth
(
user
)
op
.
check_auth
(
user
)
op
.
check_precond
()
op
.
check_precond
()
except
PermissionDenied
as
e
:
i
.
disabled
=
create_readable
(
_
(
"You are not permitted to execute
%(op)
s on instance "
"
%(instance)
s."
),
instance
=
i
.
pk
,
op
=
self
.
name
)
i
.
disabled_icon
=
"lock"
except
Exception
as
e
:
except
Exception
as
e
:
i
.
disabled
=
fetch_human_exception
(
e
)
i
.
disabled
=
fetch_human_exception
(
e
)
else
:
else
:
i
.
disabled
=
Fals
e
i
.
disabled
=
Non
e
return
instances
return
instances
def
post
(
self
,
request
,
extra
=
None
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
extra
=
None
,
*
args
,
**
kwargs
):
self
.
check_auth
()
if
extra
is
None
:
if
extra
is
None
:
extra
=
{}
extra
=
{}
self
.
_call_operations
(
extra
)
self
.
_call_operations
(
extra
)
...
...
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