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

Rozsireni ACL o delsi opravneni

parent 4ef2be69
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ __PACKAGE__->add_columns( ...@@ -18,6 +18,7 @@ __PACKAGE__->add_columns(
}, },
qw( qw(
stream_id stream_id
rights
class class
value value
), ),
......
...@@ -9,17 +9,17 @@ sub user_acl { ...@@ -9,17 +9,17 @@ sub user_acl {
my $class = shift; my $class = shift;
my $user = shift; my $user = shift;
my $grants = {}; my $rights = {};
# verejne streamy # verejne streamy
my $streams = $class->result_source->schema->resultset('Stream')->search( my $streams = $class->result_source->schema->resultset('Stream')->search(
{ is_public => 1 } { is_public => 't' }
); );
STREAM: STREAM:
while ( my $stream = $streams->next ) { while ( my $stream = $streams->next ) {
$grants->{ $stream->key} = 1; #TODO: read|write $rights->{ $stream->key } = 4;
} }
# na zaklade clenstvi ve skupine, role nebo user.id # na zaklade clenstvi ve skupine, role nebo user.id
...@@ -49,13 +49,12 @@ sub user_acl { ...@@ -49,13 +49,12 @@ sub user_acl {
} }
); );
ACL: ACL:
while ( my $acl = $acls->next ) { while ( my $acl = $acls->next ) {
$grants->{ $acl->stream->key} = 1; #TODO: read|write $rights->{ $acl->stream->key } |= $acl->rights;
} }
return $grants; return $rights;
} }
......
...@@ -28,6 +28,7 @@ create table "streams" ( ...@@ -28,6 +28,7 @@ create table "streams" (
create table "acl" ( create table "acl" (
"id" integer not null default nextval('uid_seq'), "id" integer not null default nextval('uid_seq'),
"stream_id" integer not null, "stream_id" integer not null,
"rights" smallint, -- 4 - play, 2 - push, 1 - admin
"class" text, "class" text,
"value" text, "value" text,
primary key("id"), primary key("id"),
...@@ -51,3 +52,4 @@ drop sequence "uid_seq"; ...@@ -51,3 +52,4 @@ drop sequence "uid_seq";
-- 2 up -- 2 up
alter table "streams" add "description" text; alter table "streams" add "description" text;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment