Skip to content

Conversation

@taraepp
Copy link
Collaborator

@taraepp taraepp commented Jan 21, 2026

Objective

  • new landing page
  • new behaviour:
    • basically we are saving their access request form data in our database
    • handling keycloak calls ourselves
    • giving MS users roles within mines

MDS-6681

id={props.id ?? props.input.name}
onSearch={debouncedSearch}
options={data}
value={input.value === "" ? [] : input.value}
Copy link
Collaborator Author

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)

return user_emails

@staticmethod
def get_roles_by_user(username: str):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New functions can be used to handle any keycloak role management! If we wanted to give CORE users roles from within the app...

* CORE/IDIR users are authenticated programmatically when MineSpace mounts,
*/

export const AuthenticationGuard =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was really just typescripted. No effort made to improve it otherwise (probably wouldn't use window.location)

import * as Strings from "@mds/common/constants/strings";
import PropTypes from "prop-types";
// Uncomment when image is re-introduced
// import { MAP_LOGO } from "@/constants/assets";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a lot of stuff in this file that was basically half-implemented, in testing only functionality that was either commented out, or only available on test.
I removed all of that. If we want to implement logging in with verifiable credentials or whatever was going on with the commented out stuff, we'll do that properly.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_minespace-web'

Failed conditions
71.7% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_common'

Failed conditions
31.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_core-web'

Failed conditions
64.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_core-api'

Failed conditions
74.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a new self-service user access request flow for MineSpace, where BCeID users can submit access requests through a comprehensive form. The system saves access request data to the database and manages Keycloak role assignments. Key features include:

Changes:

  • New landing page with updated design and "Join MineSpace" functionality
  • Self-service access request form for new MineSpace users with authorization workflow
  • Backend API endpoints for managing user access requests and document uploads
  • Feature flag controlled rollout (MINESPACE_SIGNUP)

Reviewed changes

Copilot reviewed 90 out of 91 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
services/minespace-web/src/components/pages/MinespaceAccessRequest.tsx New access request form component with Terms of Use and Privacy Notice
services/minespace-web/src/components/pages/LandingPage.tsx Redesigned landing page with feature flag support for new signup flow
services/minespace-web/src/HOC/AuthenticationGuard.tsx Updated authentication logic to store user access data from Keycloak
services/document-manager/backend/app/docman/resources/document.py Added authorization bypass for minespace access request document uploads
services/core-web/src/components/admin/MinespaceUserAccessModal.tsx Admin interface for reviewing and approving access requests
services/core-api/tests/users/resources/test_new_minespace_user_resource.py Comprehensive test coverage for new API endpoints

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<Typography.Paragraph>Typical processing time: 5-10 business days</Typography.Paragraph>
<Typography.Paragraph strong>What you'll need:</Typography.Paragraph>
<ul>
<li>Your role and associated business name (as registered with Business BCeiD)</li>
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "BCeiD" should be "BCeID" (lowercase 'e') to match the official branding and other instances in the codebase.

Copilot uses AI. Check for mistakes.
const clientRoles = token?.client_roles || [];

if (keycloak.authenticated && !authenticationInProgressFlag && !type) {
localStorage.setItem("authenticationInProgressFlag", "true");
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The localStorage flag is being set to the string "true" but checked as a truthy value. Consider using boolean true instead, or ensure the check elsewhere handles string "true" properly. Inconsistent types can lead to bugs.

Copilot uses AI. Check for mistakes.

assert user is not None
assert user.bceid_username == bceid_username
assert user.deleted_ind == None
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing for None should use the 'is' operator.

Copilot uses AI. Check for mistakes.
current_app.logger.info('Existing Mine: {}'.format(existing_minespace_user_mine))
if not existing_minespace_user_mine:
new_minespace_user_mine = MinespaceUserMine.create(user_id, mine.mine_guid)
new_minespace_user_mine = MinespaceUserMine.create(user_id, mine.mine_guid)
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable new_minespace_user_mine is not used.

Suggested change
new_minespace_user_mine = MinespaceUserMine.create(user_id, mine.mine_guid)
MinespaceUserMine.create(user_id, mine.mine_guid)

Copilot uses AI. Check for mistakes.
mine2 = MineFactory()

# complete permittee form submission with mines
request = MinespaceUserRequest.create_or_update_request(
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable request is not used.

Copilot uses AI. Check for mistakes.
from app.api.users.minespace.models.minespace_user_request import MinespaceUserRequest
# Import these models to ensure they're registered with SQLAlchemy (avoid circular import issues)
from app.api.users.minespace.models.minespace_user_role_xref import MinespaceUserRoleXref
from app.api.users.minespace.models.minespace_user_roles import MinespaceUserRole
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'MinespaceUserRole' is not used.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,164 @@
from datetime import datetime
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'datetime' is not used.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,164 @@
from datetime import datetime
from pytz import utc
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'utc' is not used.

Copilot uses AI. Check for mistakes.
from app.api.utils.models_mixins import SoftDeleteMixin, Base


class MinespaceUserDocumentXref(SoftDeleteMixin, Base):
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base classes have conflicting values for attribute 'delete': Function delete and Function delete.

Copilot uses AI. Check for mistakes.
from app.api.utils.models_mixins import SoftDeleteMixin, AuditMixin, Base


class MinespaceUserRoleXref(SoftDeleteMixin, AuditMixin, Base):
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base classes have conflicting values for attribute 'delete': Function delete and Function delete.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants