Skip to content
Snippets Groups Projects
Verified Commit 1f2fcefb authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Lepsi aplikace ACL, okamzite ukladani nazvu nahravky

parent eeb784d0
No related branches found
No related tags found
No related merge requests found
...@@ -4,8 +4,16 @@ use Mojo::Base 'Mojolicious::Controller'; ...@@ -4,8 +4,16 @@ use Mojo::Base 'Mojolicious::Controller';
sub list { sub list {
my $c = shift; my $c = shift;
my $readable = $c->schema->resultset('ACL')->user_acl(
$c->session->{user}, 4
);
my $cond = { 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( my $records = $c->schema->resultset('Record_view')->search(
......
...@@ -13,12 +13,18 @@ use constant HLS_URL => '/hls/%s.m3u8'; ...@@ -13,12 +13,18 @@ use constant HLS_URL => '/hls/%s.m3u8';
sub list { sub list {
my $c = shift; my $c = shift;
my $readable = $c->schema->resultset('ACL')->user_acl(
$c->session->{user}, 4
);
my $cond = { 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( my $streams = $c->schema->resultset('Stream_view')->search(
$cond, $cond,
{ order_by => 'name' } { order_by => 'name' }
...@@ -31,10 +37,6 @@ sub list { ...@@ -31,10 +37,6 @@ sub list {
my $rights = $c->session->{user}{acl}{ $stream->key }; my $rights = $c->session->{user}{acl}{ $stream->key };
if ( ! $stream->is_public ) {
next STREAM if ! $rights;
}
if ( $c->param('live') ) { if ( $c->param('live') ) {
next STREAM if ! $stream->is_live; next STREAM if ! $stream->is_live;
} }
...@@ -168,6 +170,7 @@ sub recording { ...@@ -168,6 +170,7 @@ sub recording {
if ( $recording ) { if ( $recording ) {
$stream->add_to_records({ $stream->add_to_records({
publish_user_id => $stream->publish_user_id, publish_user_id => $stream->publish_user_id,
path => $res->body,
}); });
} }
$guard->commit; $guard->commit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment