-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from CACI-MIlMOVE/Login-Gov-Delete
Okta Feature - Login.gov Deletion & Cleanup
- Loading branch information
Showing
28 changed files
with
77 additions
and
421 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
create_table("users") { | ||
t.Column("id", "uuid", {"primary": true}) | ||
t.Column("login_gov_uuid", "uuid", {}) | ||
t.Column("login_gov_email", "text", {}) | ||
t.Column("okta_id", "varchar", {}) | ||
t.Column("okta_email", "text", {}) | ||
t.Timestamps() | ||
} | ||
|
||
sql("ALTER TABLE users ADD CONSTRAINT constraint_name UNIQUE (login_gov_uuid);") |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
create_table("dps_users") { | ||
t.Column("id", "uuid", {"primary": true}) | ||
t.Column("login_gov_email", "text", {}) | ||
t.Column("okta_email", "text", {}) | ||
t.Timestamps() | ||
} |
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
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
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
3 changes: 2 additions & 1 deletion
3
migrations/app/schema/20201117222119_alter_users_login_gov_uuid_nullable.up.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 |
---|---|---|
@@ -1 +1,2 @@ | ||
ALTER TABLE users ALTER COLUMN login_gov_uuid DROP NOT NULL; | ||
-- this was commented out due to removal of the login_gov columns in an earlier migration file | ||
-- ALTER TABLE users ALTER COLUMN login_gov_uuid DROP NOT NULL; |
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 |
---|---|---|
|
@@ -12,10 +12,10 @@ WHERE email IN ('[email protected]','[email protected]','[email protected] | |
WITH office_never_signed_in AS ( | ||
SELECT * | ||
FROM office_users | ||
LEFT JOIN users ON office_users.email = users.login_gov_email | ||
WHERE users.login_gov_email IS NULL | ||
LEFT JOIN users ON office_users.email = users.okta_email | ||
WHERE users.okta_email IS NULL | ||
) | ||
INSERT INTO users (id, login_gov_email, active, created_at, updated_at) | ||
INSERT INTO users (id, okta_email, active, created_at, updated_at) | ||
SELECT uuid_generate_v4(), email, TRUE, now(), now() | ||
FROM office_never_signed_in; | ||
|
||
|
@@ -24,23 +24,23 @@ FROM office_never_signed_in; | |
WITH office_associate_user AS ( | ||
SELECT users.* | ||
FROM office_users | ||
JOIN users ON office_users.email = users.login_gov_email | ||
JOIN users ON office_users.email = users.okta_email | ||
WHERE office_users.user_id IS NULL | ||
) | ||
UPDATE office_users | ||
SET user_id = office_associate_user.id | ||
FROM office_associate_user | ||
WHERE office_users.email = office_associate_user.login_gov_email; | ||
WHERE office_users.email = office_associate_user.okta_email; | ||
|
||
-- Finds admin users who have never signed in so we must create a user record | ||
-- for them that can be updated on first sign in | ||
WITH admin_never_signed_in AS ( | ||
SELECT * | ||
FROM admin_users | ||
LEFT JOIN users ON admin_users.email = users.login_gov_email | ||
WHERE users.login_gov_email IS NULL | ||
LEFT JOIN users ON admin_users.email = users.okta_email | ||
WHERE users.okta_email IS NULL | ||
) | ||
INSERT INTO users (id, login_gov_email, active, created_at, updated_at) | ||
INSERT INTO users (id, okta_email, active, created_at, updated_at) | ||
SELECT uuid_generate_v4(), email, TRUE, now(), now() | ||
FROM admin_never_signed_in; | ||
|
||
|
@@ -49,10 +49,10 @@ FROM admin_never_signed_in; | |
WITH admin_associate_user AS ( | ||
SELECT users.* | ||
FROM admin_users | ||
JOIN users ON admin_users.email = users.login_gov_email | ||
JOIN users ON admin_users.email = users.okta_email | ||
WHERE admin_users.user_id IS NULL | ||
) | ||
UPDATE admin_users | ||
SET user_id = admin_associate_user.id | ||
FROM admin_associate_user | ||
WHERE admin_users.email = admin_associate_user.login_gov_email; | ||
WHERE admin_users.email = admin_associate_user.okta_email; |
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
9 changes: 5 additions & 4 deletions
9
migrations/app/schema/20230807185455_alter_users_table.up.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
alter table users | ||
add column okta_email text, | ||
add column okta_id varchar, | ||
alter column login_gov_email DROP NOT NULL; | ||
-- commenting these out due to introduction of these columns at an earlier migration file during change from login.gov to Okta, this is no longer needed | ||
|
||
-- alter table users | ||
-- add column okta_email text, | ||
-- add column okta_id varchar; |
3 changes: 2 additions & 1 deletion
3
migrations/app/schema/20230823194524_copy_loginGov_oktaEmail.up.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 |
---|---|---|
@@ -1 +1,2 @@ | ||
update users set okta_email = login_gov_email; | ||
-- commenting this out due to replacement of login_gov_email in previous migration file | ||
-- update users set okta_email = login_gov_email; |
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
-- intend to apply on production, but do not include any sensitive data. | ||
|
||
-- Below is an example for easy reference for future migrations (no updates to dev data actually needed) | ||
-- UPDATE users SET is_superuser = TRUE, updated_at = now() WHERE login_gov_email = '[email protected]'; | ||
-- UPDATE users SET is_superuser = TRUE, updated_at = now() WHERE okta_email = '[email protected]'; |
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
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
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
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
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
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
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
Oops, something went wrong.