-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: flag on cif_user table to allow or disallow session_sub update
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
schema/deploy/tables/cif_user_004_allow_sub_update_flag.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Deploy cif:tables/cif_user_004_allow_sub_update_flag to pg | ||
-- requires: tables/cif_user_003_create_policies | ||
|
||
begin; | ||
|
||
|
||
alter table cif.cif_user | ||
add column allow_sub_update boolean not null default false; | ||
|
||
create trigger cif_user_session_sub_immutable_with_flag | ||
before update of session_sub on cif.cif_user | ||
for each row | ||
execute function cif_private.cif_user_session_sub_immutable_with_flag_set(); | ||
|
||
-- Allowing all the existing users to update the sub once. | ||
update cif.cif_user set allow_sub_update = true; | ||
|
||
|
||
|
||
commit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Revert cif:tables/cif_user_004_allow_sub_update_flag from pg | ||
|
||
begin; | ||
|
||
alter table cif.cif_user drop column allow_sub_update; | ||
|
||
commit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Verify cif:tables/cif_user_004_allow_sub_update_flag on pg | ||
|
||
begin; | ||
|
||
select allow_sub_update from cif.cif_user limit 0; | ||
|
||
rollback; |