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
428c391f
authored
Apr 24, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acl: disregard superuser in get objects with lvl
parent
451790d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
circle/acl/models.py
+3
-2
circle/dashboard/views.py
+1
-1
No files found.
circle/acl/models.py
View file @
428c391f
...
@@ -177,12 +177,13 @@ class AclBase(Model):
...
@@ -177,12 +177,13 @@ class AclBase(Model):
@classmethod
@classmethod
def
get_objects_with_level
(
cls
,
level
,
user
,
def
get_objects_with_level
(
cls
,
level
,
user
,
group_also
=
True
,
owner_also
=
False
):
group_also
=
True
,
owner_also
=
False
,
disregard_superuser
=
False
):
logger
.
debug
(
'
%
s.get_objects_with_level(
%
s,
%
s) called'
,
logger
.
debug
(
'
%
s.get_objects_with_level(
%
s,
%
s) called'
,
unicode
(
cls
),
unicode
(
level
),
unicode
(
user
))
unicode
(
cls
),
unicode
(
level
),
unicode
(
user
))
if
user
is
None
or
not
user
.
is_authenticated
():
if
user
is
None
or
not
user
.
is_authenticated
():
return
cls
.
objects
.
none
()
return
cls
.
objects
.
none
()
if
getattr
(
user
,
'is_superuser'
,
False
):
if
getattr
(
user
,
'is_superuser'
,
False
)
and
not
disregard_superuser
:
logger
.
debug
(
'- superuser granted'
)
logger
.
debug
(
'- superuser granted'
)
return
cls
.
objects
return
cls
.
objects
if
isinstance
(
level
,
basestring
):
if
isinstance
(
level
,
basestring
):
...
...
circle/dashboard/views.py
View file @
428c391f
...
@@ -90,7 +90,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
...
@@ -90,7 +90,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
# instances
# instances
favs
=
Instance
.
objects
.
filter
(
favourite__user
=
self
.
request
.
user
)
favs
=
Instance
.
objects
.
filter
(
favourite__user
=
self
.
request
.
user
)
instances
=
Instance
.
get_objects_with_level
(
instances
=
Instance
.
get_objects_with_level
(
'user'
,
user
)
.
filter
(
destroyed_at
=
None
)
'user'
,
user
,
disregard_superuser
=
True
)
.
filter
(
destroyed_at
=
None
)
display
=
list
(
favs
)
+
list
(
set
(
instances
)
-
set
(
favs
))
display
=
list
(
favs
)
+
list
(
set
(
instances
)
-
set
(
favs
))
for
d
in
display
:
for
d
in
display
:
d
.
fav
=
True
if
d
in
favs
else
False
d
.
fav
=
True
if
d
in
favs
else
False
...
...
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