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
e9db2e65
authored
Mar 24, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: implement check_auth method of operations
parent
57fc676a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
circle/vm/models/operation.py
+9
-2
No files found.
circle/vm/models/operation.py
View file @
e9db2e65
...
...
@@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
from
logging
import
getLogger
from
string
import
ascii_lowercase
from
django.core.exceptions
import
PermissionDenied
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -43,7 +44,7 @@ class Operation:
"""This method contains the shared prelude of __call__ and async.
"""
user
=
kwargs
.
setdefault
(
'user'
,
None
)
self
.
check_auth
(
user
)
# TODO what's check_auth's specification?
self
.
check_auth
(
user
)
self
.
check_precond
()
return
self
.
create_activity
(
user
=
user
)
...
...
@@ -76,7 +77,13 @@ class Operation:
pass
def
check_auth
(
self
,
user
):
pass
if
not
self
.
instance
.
has_level
(
user
,
self
.
acl_level
):
raise
PermissionDenied
(
"
%
s doesn't have the required ACL level."
%
user
)
if
not
user
.
has_perms
(
self
.
required_perms
):
raise
PermissionDenied
(
"
%
s doesn't have the required permissions."
%
user
)
def
create_activity
(
self
,
user
=
None
):
return
InstanceActivity
.
create
(
code_suffix
=
self
.
activity_code_suffix
,
...
...
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