diff --git a/lib/PiTube/Schema/ResultSet/ACL.pm b/lib/PiTube/Schema/ResultSet/ACL.pm
new file mode 100644
index 0000000000000000000000000000000000000000..8cbf6c324cd264d77cbf2bb879e6ea70bdfefd14
--- /dev/null
+++ b/lib/PiTube/Schema/ResultSet/ACL.pm
@@ -0,0 +1,61 @@
+package PiTube::Schema::ResultSet::ACL;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::ResultSet';
+
+sub user_acl {
+    my $class = shift;
+    my $user  = shift;
+
+    my $grants = {};
+
+    # verejne streamy
+
+    my $streams = $class->result_source->schema->resultset('Stream')->search(
+        { is_public => 1 }
+    );
+
+    STREAM:
+    while ( my $stream = $streams->next ) {
+        $grants->{ $stream->key} = 1; #TODO: read|write
+    }
+
+    # na zaklade role
+
+    my $acls = $class->search(
+        {
+            -or => [
+                {
+                    class => 'all',
+                },
+                {
+                    class => 'role',
+                    value => { '-in' => $user->{roles} },
+                },
+                {
+                    class => 'user',
+                    value => $user->{id},
+                },
+            ]
+        },
+        {
+            join => 'stream'
+        }
+    );
+
+
+    ACL:
+    while ( my $acl = $acls->next ) {
+        $grants->{ $acl->stream->key} = 1; #TODO: read|write
+    }
+
+    return $grants;
+
+}
+
+1;
+
+__END__
+