Skip to content
Snippets Groups Projects
Commit 3e3cbfab authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

fix AnonymousUser permissions

parent 8d754214
No related branches found
No related tags found
No related merge requests found
Pipeline #13622 passed
......@@ -44,6 +44,7 @@
{% endif %}
</div>
{% if user.is_authenticated %}
<script>
window.isRegistered = {% if user|is_registered:lecture %}
true
......@@ -51,6 +52,7 @@
false
{% endif %};
</script>
{% endif %}
<div class="flex flex-col gap-2 my-4 py-4 border-y border-gray-200">
<div class="flex justify-between gap-2 text-lg text-gray-600">
......
......@@ -79,7 +79,10 @@ def get_lectures(request, filter=None, get_exceptions: bool = True) -> tuple:
)
)
& (
(
models.Q(user_groups__in=request.user.groups.all())
| models.Q(user_groups=None)
)
if not request.user.is_superuser
else models.Q(id__isnull=False) # Always True
)
......@@ -136,7 +139,10 @@ def view_group_lectures(request, group_id: int):
group_id_exists = group.exists()
if not request.user.is_superuser:
group = group.filter(models.Q(user_groups__in=request.user.groups.all()))
group = group.filter(
models.Q(user_groups__in=request.user.groups.all())
| models.Q(user_groups=None)
)
if not group.exists():
if not group_id_exists: # Doesn't exist at all
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment