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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
a25f2d4a
authored
Jul 23, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: rewrite AclUpdateView.has_next_level
parent
dbbb156a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
circle/dashboard/views.py
+7
-12
No files found.
circle/dashboard/views.py
View file @
a25f2d4a
...
...
@@ -1064,8 +1064,8 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
@classmethod
def
get_acl_data
(
cls
,
obj
,
user
,
url
):
levels
=
obj
.
ACL_LEVELS
allowed_levels
=
list
(
l
[
0
]
for
l
in
obj
.
ACL_LEVELS
if
cls
.
has_next_level
(
user
,
obj
,
l
[
0
]
))
allowed_levels
=
list
(
l
for
l
in
OrderedDict
(
levels
)
if
cls
.
has_next_level
(
user
,
obj
,
l
))
is_owner
=
'owner'
in
allowed_levels
allowed_users
=
cls
.
get_allowed_users
(
user
)
...
...
@@ -1087,16 +1087,11 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
@classmethod
def
has_next_level
(
self
,
user
,
instance
,
level
):
# TODO
levels
=
zip
(
*
instance
.
ACL_LEVELS
)[
0
]
try
:
i
=
levels
.
index
(
level
)
except
ValueError
:
i
=
0
if
i
<
(
len
(
levels
)
-
1
):
i
+=
1
next_level
=
levels
[
i
]
levels
=
OrderedDict
(
instance
.
ACL_LEVELS
)
.
keys
()
next_levels
=
dict
(
zip
([
None
]
+
levels
,
levels
+
levels
[
-
1
:]))
# {None: 'user', 'user': 'operator', 'operator: 'owner',
# 'owner: 'owner'}
next_level
=
next_levels
[
level
]
return
instance
.
has_level
(
user
,
next_level
)
@classmethod
...
...
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