fix: RBAC private media visibility in playlists (#1370)#1452
Open
mrjoshuap wants to merge 3 commits intomediacms-io:mainfrom
Open
fix: RBAC private media visibility in playlists (#1370)#1452mrjoshuap wants to merge 3 commits intomediacms-io:mainfrom
mrjoshuap wants to merge 3 commits intomediacms-io:mainfrom
Conversation
Private media assigned to RBAC categories was visible in category views and detail pages for authorized group members, but not in playlists. This inconsistency occurred because the playlist view only checked media state (public/unlisted) instead of applying the same permission logic used elsewhere. Changes: - Add MediaPermission import to playlists.py - Create _get_accessible_media_filter() helper method that builds Q object for media visibility based on: * listable=True (public media) * Direct MediaPermission for the user * RBAC category membership (when USE_RBAC=True) - Update PlaylistDetail.get() to use permission filter instead of simple state check for non-owners The implementation now matches the permission logic in _get_media_queryset() from files/views/media.py, ensuring consistent behavior across the application. Fixes mediacms-io#1370
ab79876 to
7eb661d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes issue where private media accessible via RBAC groups or direct MediaPermission was not visible in playlists, even though it appeared correctly in category views and detail pages.
The playlist view was only checking media state (
public/unlisted) instead of applying the full permission logic. This PR updatesPlaylistDetail.get()to use the same permission filtering as media listings, ensuring:Implementation:
_get_accessible_media_filter()helper method that respectslistable, direct permissions, and RBAC category accessSteps
Pre-deploy
Post-deploy
This should fix #1370.