Skip to content

Commit

Permalink
Add Cascadia reporter role for read-only access
Browse files Browse the repository at this point in the history
  • Loading branch information
davereinhart committed Aug 21, 2023
1 parent 9e8f522 commit 1e13387
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
10 changes: 9 additions & 1 deletion schema/deploy/roles/cascadia/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
begin;

create role "cascadia";
grant "reporter" to "cascadia";

grant "cascadia" to "consensus-genome-processor";

comment on role "cascadia" is
'For row-level access to Cascadia data';


create role "reporter-cascadia";

grant "cascadia" to "reporter-cascadia";
grant "reporter" to "reporter-cascadia";

comment on role "reporter-cascadia" is
'For row-level read access to Cascadia data';

commit;
1 change: 1 addition & 0 deletions schema/revert/roles/cascadia/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
begin;

drop role cascadia;
drop role "reporter-cascadia";

commit;
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ begin
(access_role is null and sample_id = other_sample_id)
);

set local role cascadia;
set local role 'reporter-cascadia';

assert 2 = (
select count(*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ begin
(access_role::text = 'cascadia' and consensus_genome_id = other_consensus_genome_id)
);

set local role cascadia;
set local role 'reporter-cascadia';

assert 2 = (
select count(*)
Expand Down
2 changes: 1 addition & 1 deletion schema/verify/warehouse/sample/cascadia-rls-constraint.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ begin
where sample_id = sample_number
);

set local role cascadia;
set local role 'reporter-cascadia';

assert 1 = (
select count(*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ begin
(access_role::text = 'cascadia' and sample_id = other_sample_id)
);

set local role cascadia;
set local role 'reporter-cascadia';

assert 2 = (
select count(*)
Expand Down

0 comments on commit 1e13387

Please sign in to comment.