Skip to content

Commit

Permalink
Only add perms with write or owner permission in backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrahn committed Oct 11, 2023
1 parent b76cbe9 commit e03620a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/Routes/Playlist/PlaylistVideoList.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ public function __invoke(Request $request, Response $response, $args)

$ret = [];
foreach ($videos['videos'] as $video) {
# TODO Who has access to the perms list? currently everyone (frontend needs to handle this)
$video_array = $video->toSanitizedArray($params['cid'], $playlist->id);
$video_array['perms'] = $video->perms->toSanitizedArray();
if (!empty($video_array['perm']) && ($video_array['perm'] == 'owner' || $video_array['perm'] == 'write'))
{
$video_array['perms'] = $video->perms->toSanitizedArray();
}
$ret[] = $video_array;
}

Expand Down
6 changes: 4 additions & 2 deletions lib/Routes/Video/VideoList.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ public function __invoke(Request $request, Response $response, $args)

$ret = [];
foreach ($videos['videos'] as $video) {
# TODO Who has access to the perms list? currently everyone (frontend needs to handle this)
$video_array = $video->toSanitizedArray();
$video_array['perms'] = $video->perms->toSanitizedArray();
if (!empty($video_array['perm']) && ($video_array['perm'] == 'owner' || $video_array['perm'] == 'write'))
{
$video_array['perms'] = $video->perms->toSanitizedArray();
}
$ret[] = $video_array;
}

Expand Down
8 changes: 5 additions & 3 deletions vueapp/components/Videos/VideoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ export default {
getAccessText() {
var txt = '';
this.event.perms.forEach(perm => {
txt += '<div>' + perm.fullname + ': ' + perm.perm + '</div>'
});
if (this.event?.perms) {
this.event.perms.forEach(perm => {
txt += '<div>' + perm.fullname + ': ' + perm.perm + '</div>'
});
}
return txt;
},
Expand Down

0 comments on commit e03620a

Please sign in to comment.