Skip to content

Commit

Permalink
🐛 Fix enriched videos in playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienCozeDev committed Nov 7, 2023
1 parent 2637772 commit ed1d9f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pod/enrichment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def video_enrichment(request, slug, slug_c=None, slug_t=None, slug_private=None)
"videos": videos,
}
else:
return HttpResponseNotFound()
raise PermissionDenied(_("You cannot access this playlist because it is private."))
template_video = (
"enrichment/video_enrichment-iframe.html"
if (request.GET.get("is_iframe"))
Expand Down
9 changes: 6 additions & 3 deletions pod/playlist/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,11 @@ def playlist_can_be_displayed(request: WSGIRequest, playlist: Playlist) -> bool:
playlist.visibility == "public"
or playlist.visibility == "protected"
or (
playlist.owner == request.user
or playlist in get_playlists_for_additional_owner(request.user)
or request.user.is_staff
request.user.is_authenticated
and (
playlist.owner == request.user
or playlist in get_playlists_for_additional_owner(request.user)
or request.user.is_staff
)
)
)
3 changes: 2 additions & 1 deletion pod/video/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Esup-Pod videos views."""
from django.core.exceptions import PermissionDenied
from django.core.handlers.wsgi import WSGIRequest
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.serializers.json import DjangoJSONEncoder
Expand Down Expand Up @@ -887,7 +888,7 @@ def video(request, slug, slug_c=None, slug_t=None, slug_private=None):
"videos": videos,
}
else:
return HttpResponseNotFound()
raise PermissionDenied(_("You cannot access this playlist because it is private."))
return render_video(request, id, slug_c, slug_t, slug_private, template_video, params)


Expand Down

0 comments on commit ed1d9f4

Please sign in to comment.