Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
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
Show 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):
@classmethod
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'
,
unicode
(
cls
),
unicode
(
level
),
unicode
(
user
))
if
user
is
None
or
not
user
.
is_authenticated
():
return
cls
.
objects
.
none
()
if
getattr
(
user
,
'is_superuser'
,
False
):
if
getattr
(
user
,
'is_superuser'
,
False
)
and
not
disregard_superuser
:
logger
.
debug
(
'- superuser granted'
)
return
cls
.
objects
if
isinstance
(
level
,
basestring
):
...
...
circle/dashboard/views.py
View file @
428c391f
...
...
@@ -90,7 +90,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
# instances
favs
=
Instance
.
objects
.
filter
(
favourite__user
=
self
.
request
.
user
)
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
))
for
d
in
display
:
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