Skip to content
Snippets Groups Projects
Commit adbf5946 authored by Valentin Rigal's avatar Valentin Rigal
Browse files

Handle anonymous user

parent adac5da6
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,15 @@ class ACLMixin(object):
"""
Return a model queryset matching a given access level for this user
"""
# Handle specific cases (i.e. admin or anonymous user)
if self.user.is_admin or self.user.is_internal:
return model.objects.all()
elif user.is_anonymous:
if level > Role.Guest.value or not public:
return model.objects.none()
else:
return model.objects.filter(public=True)
queryset = model.objects \
.filter(
# Filter instances with direct and groups rights for this user (They may be duplicated)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment