Skip to content

DBC: A (specific?) user with a converted in sole prop has no User record in the business database to compare proprietor name against #30277

Closed

Description

@loneil

Investigating a known user who has an old Sole Proprietorship that is not presented with the Digital Business Card option when they access their SP via BCROS using a BC Services Card.

Won't put PII name/etc in this ticket but have observed the following:

User logs in with a BCSC with their connected mobile app and can access the BCROS

Image

The user account info is

Image

They registered back in 2000 with this SP.
So the registration completing party name is a generic old user name

In 2021 they contacted BC Registries and converted and updated. So those filings are an internal user.

Aside from all the above, the Proprietor Name we have confirmed exactly matches the BCSC name. In the current code this is intended to allow a DBC issuance.

Have investigated with the user and inspected the JWT for their access token (ISS https://loginproxy.gov.bc.ca/auth/realms/bcregistry). The first name and last name in the token match as expected.

Image

The idp_userid is confirmed to have no corresponding record in the business DB users table. Which is not the case for newer Sole Props, the idp_userid for the logged in user session is looked up to find a User, and that User is name matched against the proprietor as the check that should be passing here to allow DBC.

Can see the match in question:
https://github.com/bcgov/lear/blob/main/legal-api/src/legal_api/services/digital_credentials_rules.py#L170
The passed in User (can follow call stack in that file) is coming from the lookup of the User by the matching idp_userid

Activity

  1. changed the title [-]DBC: A user with a converted in sole prop has no User record in the business database to compare proprietor name against[/-] [+]DBC: A (specific?) user with a converted in sole prop has no User record in the business database to compare proprietor name against[/+] on Aug 19, 2025
  2. added
    Entities Team
    on Aug 19, 2025
  3. loneil commented on Aug 19, 2025

    @loneil
    CollaboratorAuthor

    Copying my note from previous chat:

    "
    Ok so for the situation with Alykahn I would break it down like this

    • He has a sole prop that was converted in to the new system
    • His BCSC name matches the proprietor name
    • The Profile he has on that Account is a business, not an individual (not sure this matters, does not seem to, but noting)
    • The idp_userid from the token that his BCSC login for the profile grants does not correspond to a User in the database
    • We match User to the Proprietor in this case and find nothing, so no DBC option
    • Even if we did go by an upcoming(?) Account Coordinator/Admin association, what would we issue in the DBC if there is no User record?

    So I'm now past my knowledge level an over my head for the auth system and how Users work, so think we'll need someone from Registries to chime in on whether this is a known case? Is Alykhan a data problem? Will this happen for all converted in firms?
    "

    So will need to follow up with someone shortly on this. (probably SBC Auth developer, Severin suggested a couple folks)

  4. loneil commented on Nov 12, 2025

    @loneil
    CollaboratorAuthor

    Ameliorated by #31227 for DBC access/issuance
    Though for legacy user imported if this case occurs this is something to figure out at some point, especially during phase 3 name-change initiatives. Not specific to Phase 2 (structural with migrated users if this case occurs with any existing DBC implementations)

  5. loneil commented on Nov 17, 2025

    @loneil
    CollaboratorAuthor

    Encountered a second user, also an older SP migrated in, with this situation (ITOPS-154341) that was confirmed to also have no User record.
    Same comment/details as above, should be accessible after #31227, but broader questions come up about the lack of a User record in Lear...

    1. Does this data case need to be taken into account for future DBC requirements/development? IE does "user information" need to be solely from the login token as we can't reliably assume there's a User record?
    2. Regardless of Digital Business Card, for general BC Registries Online Services is this a invalid data case? The Lear database has no User table for some imported users logging in with a BCSC. So the BCSC identifier does not link to any User record. Is this just an expected and fine data condition?
      • Are there potentially other issues that could happen in BCROS that haven't been encountered yet other than the DBC expecting a User?
      • Who to discuss this issue with? Auth team? Any DBA concerns with validity of this data model or anything?
    3. For corporation migrations is this going to be a problem that needs taking into account (again, regardless of DBC)? Is this just an artifact of some Firm migration or would/does this happen for Corps? Is it invalid data if so
  6. Mihai-QuickSilverDev commented on Feb 14, 2026

    @Mihai-QuickSilverDev
    Collaborator

    Hi @loneil

    • Without reading every single line above, would we be able to correct this record only, through whatever means possible - data fixes, etc.
    • This above would be Priority 1. Then we can take the time to understand, and potentially remediate a root cause.
  7. loneil commented on Feb 24, 2026

    @loneil
    CollaboratorAuthor

    For the production users we've seen this crop up in I have confirmed they both have DBCs now.

  8. loneil commented on Feb 24, 2026

    @loneil
    CollaboratorAuthor

    It looks like the root cause of this issue has actually been addressed a couple months back in this PR:
    bcgov/lear#3762

    So this is actually fixed now and doesn't require any further changes.

    Now in the request context setup it will do the User.get_or_create_user_by_jwt()
    see https://github.com/bcgov/lear/blob/89b8083bed4318847aa9483968088b55a5e66927/legal-api/src/legal_api/services/request_context.py#L39

    So when accessing the DBC functionality a user will always pass through a path that actions the new request context setup

    User opens business dashboard
    → UI calls GET /businesses/{identifier}/allowableActions (or similar)
    → get_allowable_actions() → get_allowed_filings() → get_request_context()
    → user is get_or_create'd ✅
    → response includes digitalBusinessCard: true/false

  9. Mihai-QuickSilverDev commented on Feb 25, 2026

    @Mihai-QuickSilverDev
    Collaborator
    • Several Prod verifications confirm the fix.
    • This ticket can be safely closed.
    • No Release required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Entities Team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions