-
Notifications
You must be signed in to change notification settings - Fork 37
[MDS-6681] MineSpace User Access Login flow #3803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
taraepp
wants to merge
5
commits into
develop
Choose a base branch
from
mds-6681-ms-user-access
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
migrations/sql/V2025.12.16.11.28__minespace_user_access_request.sql
This file contains hidden or 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,57 @@ | ||
| CREATE TABLE IF NOT EXISTS minespace_user_role ( | ||
| minespace_user_role_code VARCHAR(3) PRIMARY KEY, | ||
| description VARCHAR(100) NOT NULL, | ||
| active_ind boolean DEFAULT true NOT NULL, | ||
| create_user VARCHAR(60) NOT NULL, | ||
| create_timestamp timestamp with time zone DEFAULT now() NOT NULL, | ||
| update_user VARCHAR(60) NOT NULL, | ||
| update_timestamp timestamp with time zone DEFAULT now() NOT NULL | ||
| ); | ||
| COMMENT ON TABLE minespace_user_role IS 'Roles that a minespace user may have with a mine'; | ||
|
|
||
| INSERT INTO minespace_user_role ( | ||
| minespace_user_role_code, | ||
| description, | ||
| create_user, | ||
| update_user | ||
| ) VALUES ('PMT', 'Permittee', 'system-mds', 'system-mds'), | ||
| ('MMG', 'Mine Manager', 'system-mds', 'system-mds'), | ||
| ('ADM', 'MineSpace Administrator', 'system-mds', 'system-mds'), | ||
| ('EMP', 'Employee', 'system-mds', 'system-mds'), | ||
| ('CON', 'Contractor/Consultant', 'system-mds', 'system-mds'), | ||
| ('AGT', 'Agent', 'system-mds', 'system-mds'), | ||
| ('NUL', 'General Public/Researcher', 'system-mds', 'system-mds'); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS minespace_user_role_xref ( | ||
| minespace_user_role_xref_guid UUID DEFAULT gen_random_uuid() PRIMARY KEY, | ||
| minespace_user_role_code VARCHAR(3) NOT NULL, | ||
| minespace_user_id INT NOT NULL, | ||
| mine_guid UUID NOT NULL, | ||
| is_pending BOOLEAN NOT NULL, | ||
| deleted_ind BOOLEAN DEFAULT false NOT NULL, | ||
| create_user VARCHAR(60) NOT NULL, | ||
| create_timestamp timestamp with time zone DEFAULT now() NOT NULL, | ||
| update_user VARCHAR(60) NOT NULL, | ||
| update_timestamp timestamp with time zone DEFAULT now() NOT NULL, | ||
|
|
||
| CONSTRAINT fk_minespace_user_role_code FOREIGN KEY (minespace_user_role_code) | ||
| REFERENCES minespace_user_role(minespace_user_role_code), | ||
| CONSTRAINT fk_minespace_user_id FOREIGN KEY (minespace_user_id) | ||
| REFERENCES minespace_user(user_id), | ||
| CONSTRAINT fk_minespace_user_mine_role FOREIGN KEY (mine_guid) | ||
| REFERENCES mine(mine_guid) | ||
| ); | ||
| COMMENT ON TABLE minespace_user_role_xref IS 'Xref between the minespace user and the role they have (or requested to have) for a mine'; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS minespace_user_document_xref ( | ||
| minespace_user_document_xref_guid UUID DEFAULT gen_random_uuid() PRIMARY KEY, | ||
| minespace_user_id INT NOT NULL, | ||
| document_manager_guid UUID NOT NULL, | ||
| document_name VARCHAR(255) NOT NULL, | ||
| upload_date DATE DEFAULT now() NOT NULL, | ||
| deleted_ind BOOLEAN DEFAULT false NOT NULL, | ||
|
|
||
| CONSTRAINT fk_minespace_user_id FOREIGN KEY (minespace_user_id) | ||
| REFERENCES minespace_user(user_id) | ||
| ); | ||
| COMMENT ON TABLE minespace_user_document_xref IS 'Authorization letter document tied to minespace user access request'; |
36 changes: 36 additions & 0 deletions
36
migrations/sql/V2025.12.23.19.47__create_minespace_user_request.sql
This file contains hidden or 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,36 @@ | ||
| -- Create minespace_user_request table to track user access request submissions | ||
| CREATE TABLE IF NOT EXISTS minespace_user_request ( | ||
| minespace_user_request_id SERIAL PRIMARY KEY, | ||
| user_sub VARCHAR(255) NOT NULL UNIQUE, | ||
| minespace_user_id INT, | ||
| submitted_timestamp timestamp with time zone DEFAULT now() NOT NULL, | ||
| role_requested VARCHAR(3), | ||
| business_name VARCHAR(255), | ||
| access_request_text VARCHAR(100), | ||
| ministry_contact VARCHAR(100), | ||
| permittee JSONB, | ||
| request_status SMALLINT DEFAULT 0 NOT NULL, | ||
| create_user VARCHAR(60) NOT NULL, | ||
| create_timestamp timestamp with time zone DEFAULT now() NOT NULL, | ||
| update_user VARCHAR(60) NOT NULL, | ||
| update_timestamp timestamp with time zone DEFAULT now() NOT NULL, | ||
|
|
||
| CONSTRAINT fk_minespace_user_id FOREIGN KEY (minespace_user_id) | ||
| REFERENCES minespace_user(user_id), | ||
| CONSTRAINT fk_role_requested FOREIGN KEY (role_requested) | ||
| REFERENCES minespace_user_role(minespace_user_role_code) | ||
| ); | ||
|
|
||
| COMMENT ON TABLE minespace_user_request IS 'Tracks minespace user access request form submissions. The user_sub from the BCeID token uniquely identifies the request and can be linked to minespace_user once created.'; | ||
| COMMENT ON COLUMN minespace_user_request.user_sub IS 'BCeID sub claim from JWT token - uniquely identifies the user'; | ||
| COMMENT ON COLUMN minespace_user_request.minespace_user_id IS 'Foreign key to minespace_user - will be null until the user record is created'; | ||
| COMMENT ON COLUMN minespace_user_request.submitted_timestamp IS 'When the user submitted the access request form'; | ||
| COMMENT ON COLUMN minespace_user_request.role_requested IS 'The role/position the user requested'; | ||
| COMMENT ON COLUMN minespace_user_request.business_name IS 'Business name for contractors/consultants registered with Business BCeID'; | ||
| COMMENT ON COLUMN minespace_user_request.access_request_text IS 'Additional text from the user about mines/permits not in the system'; | ||
| COMMENT ON COLUMN minespace_user_request.ministry_contact IS 'Email of MCM Inspector or staff member the user has been in contact with'; | ||
| COMMENT ON COLUMN minespace_user_request.permittee IS 'Permittee contact information in JSON format (name, title, email, phone)'; | ||
| COMMENT ON COLUMN minespace_user_request.request_status IS 'Status of the request: 0 = Pending, 1 = Approved, 2 = Rejected'; | ||
|
|
||
| -- Create index on user_sub for efficient lookups | ||
| CREATE INDEX idx_minespace_user_request_user_sub ON minespace_user_request(user_sub); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had weird issues with the mines not being pre-populated from the form values and had to make this change. In making this change, I had to manually apply the aria-required (a bunch of snapshot tests showed it being removed. Now it added in a few aria-required=false but I'm okay with that)