Skip to content

Conversation

@mrjoshuap
Copy link
Contributor

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 updates PlaylistDetail.get() to use the same permission filtering as media listings, ensuring:

  • RBAC group members see private media in playlists when they have category access
  • Users with direct MediaPermission see private media in playlists
  • Playlist owners continue to see all their media (unchanged behavior)

Implementation:

  • Added _get_accessible_media_filter() helper method that respects listable, direct permissions, and RBAC category access
  • Updated playlist media query to use comprehensive permission filter instead of state-only check

Steps

Pre-deploy

  • None required

Post-deploy

  • None required

This should fix #1370.

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
@mrjoshuap mrjoshuap force-pushed the fix-rbac-for-playlists branch from ab79876 to 7eb661d Compare December 24, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RBAC: Private media not displayed in playlists for authorized group members

1 participant