diff --git a/lib/PiTube/Controller/Record.pm b/lib/PiTube/Controller/Record.pm index 67be99c4aafd842d950d817f36c18ad9289bcf5d..cc823daf1dc623c7a2187c85347ddbcea9dcb7cf 100644 --- a/lib/PiTube/Controller/Record.pm +++ b/lib/PiTube/Controller/Record.pm @@ -4,8 +4,16 @@ use Mojo::Base 'Mojolicious::Controller'; sub list { my $c = shift; + my $readable = $c->schema->resultset('ACL')->user_acl( + $c->session->{user}, 4 + ); + my $cond = { - is_active => 't' + is_active => 't', + -or => [ + { stream_is_public => 't' }, + { stream_key => { -in => $readable }}, + ] }; my $records = $c->schema->resultset('Record_view')->search( diff --git a/lib/PiTube/Controller/Stream.pm b/lib/PiTube/Controller/Stream.pm index 17e07e27671527fe7a23f7d733b810c76caad548..d0b64c2071f0e75cae2d07c29208aef6be5c0fe1 100644 --- a/lib/PiTube/Controller/Stream.pm +++ b/lib/PiTube/Controller/Stream.pm @@ -13,12 +13,18 @@ use constant HLS_URL => '/hls/%s.m3u8'; sub list { my $c = shift; + my $readable = $c->schema->resultset('ACL')->user_acl( + $c->session->{user}, 4 + ); + my $cond = { - is_active => 't' + is_active => 't', + -or => [ + { is_public => 't' }, + { key => { -in => $readable }}, + ] }; - $cond->{is_public} = 't' if ! $c->is_user_authenticated; - my $streams = $c->schema->resultset('Stream_view')->search( $cond, { order_by => 'name' } @@ -31,10 +37,6 @@ sub list { my $rights = $c->session->{user}{acl}{ $stream->key }; - if ( ! $stream->is_public ) { - next STREAM if ! $rights; - } - if ( $c->param('live') ) { next STREAM if ! $stream->is_live; } @@ -168,6 +170,7 @@ sub recording { if ( $recording ) { $stream->add_to_records({ publish_user_id => $stream->publish_user_id, + path => $res->body, }); } $guard->commit;