Commit 7eb661d
committed
Fix: RBAC private media visibility in playlists
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 #13701 parent 8725713 commit 7eb661d
1 file changed
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
85 | 110 | | |
86 | 111 | | |
87 | 112 | | |
| |||
95 | 120 | | |
96 | 121 | | |
97 | 122 | | |
98 | | - | |
| 123 | + | |
99 | 124 | | |
100 | 125 | | |
101 | 126 | | |
102 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
103 | 130 | | |
104 | 131 | | |
105 | 132 | | |
| |||
0 commit comments