Skip to content

Adding new Officers

Barrett Falk edited this page Jun 19, 2024 · 6 revisions

To add a new officer manually:

  1. Add the officer to Common Hosted Single Sign-on (CSS): https://bcgov.github.io/sso-requests. Add the user to the desired environment, and assign them the desired role.

  2. Insert the user into the database

WITH inserted AS (
  INSERT INTO public.person
  (person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp)
  VALUES(gen_random_uuid(), 'Frodo', NULL, NULL, 'Baggins', 'FLYWAY', now(), 'FLYWAY', now())
  ON CONFLICT DO NOTHING
  RETURNING person_guid
)
INSERT INTO public.officer
(officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid)
SELECT gen_random_uuid(), 'FBAGGINS', 'FLYWAY', now(), 'FLYWAY', now(), person_guid, '<insert office guid here>'::uuid
FROM inserted
ON CONFLICT DO NOTHING;
  1. Grant the user access to the coms bucket (see COMS Section). Note that users will need to login to the application after step 2 before this step will work.

Note, if adding this to a repeatable flyway script, you should use a hard-coded guid for the person and officer instead of. gen_random_uuid(). This will prevent adding duplicate people/officers to the database.

Clone this wiki locally