Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 603ef76

Browse files
authored
Merge pull request #4770 from mruff-aeq/34855_completing_party_bceid_skip
34855 restrict completing party name check to BCSC clients (BUG FIX)
2 parents 22e25b3 + 4cabbe0 commit 603ef76

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

legal-api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "legal-api"
3-
version = "3.1.26"
3+
version = "3.1.27"
44
description = ""
55
authors = [
66
{name = "thor",email = "[email protected]"}

legal-api/src/legal_api/services/filings/validations/registration.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,19 @@ def validate_party(filing: dict, legal_type: str, filing_type="registration") ->
171171
def validate_completing_party_name(filing: dict, filing_type="registration") -> list:
172172
"""Validate the completing party name matches the submitting user's name.
173173
174-
Clients cannot edit the completing party (it is pre-populated from their login),
175-
so the submitted name must match their user record; registry and SBC staff enter it
176-
manually from a paper form and API gateway users have their own workflow, so those
177-
are skipped.
174+
BC Services Card clients cannot edit the completing party (it is pre-populated from
175+
their verified login), so the submitted name must match their user record. Registry and
176+
SBC staff enter it manually from a paper form, API gateway users have their own workflow
177+
and other login sources (e.g. BCeID) carry an editable display name rather than a verified
178+
legal name, so those are skipped.
178179
"""
179-
api_login_source = "API_GW" # jwt loginSource of an API gateway user
180+
bcsc_login_source = "BCSC" # jwt loginSource of a BC Services Card user
180181
msg = []
181182
current_user = getattr(request_ctx, "current_user", None) if has_request_context() else None
182183
if (not current_user
183184
or jwt.validate_roles(current_user, [STAFF_ROLE])
184185
or jwt.validate_roles(current_user, [SBC_STAFF_ROLE])
185-
or current_user.get("loginSource") == api_login_source):
186+
or current_user.get("loginSource") != bcsc_login_source):
186187
return msg
187188

188189
officer = None
@@ -201,6 +202,8 @@ def validate_completing_party_name(filing: dict, filing_type="registration") ->
201202
user_name = " ".join(" ".join(
202203
filter(None, [user.firstname, user.middlename, user.lastname])
203204
).split())
205+
if not user_name:
206+
return msg # nothing on record to compare against
204207
filing_name = " ".join(" ".join(
205208
filter(None, [officer.get("firstName"), officer.get("middleName"), officer.get("lastName")])
206209
).split())

legal-api/tests/unit/services/filings/validations/test_registration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ def mock_check(permissions_msg, filing_type):
455455
('client_first_filing_user_created_from_token', [BASIC_USER], 'BCSC', None, ('Joe P', 'Swanson'), None),
456456
('client_first_filing_token_name_mismatch', [BASIC_USER], 'BCSC', None, ('Different', 'Person'),
457457
MISMATCH_ERROR),
458-
('client_user_record_no_name', [BASIC_USER], 'BCSC', (None, None, None), None, MISMATCH_ERROR),
458+
('client_user_record_no_name_skipped', [BASIC_USER], 'BCSC', (None, None, None), None, None),
459+
('bceid_display_name_skipped', [BASIC_USER], 'BCEID', ('Nevneet Grewal', None, None), None, None),
459460
('staff_skipped', [STAFF_ROLE], 'IDIR', ('Different', None, 'Person'), None, None),
460461
('sbc_staff_skipped', [SBC_STAFF_ROLE], 'IDIR', ('Different', None, 'Person'), None, None),
461462
('api_gw_skipped', [BASIC_USER], 'API_GW', ('Different', None, 'Person'), None, None),

0 commit comments

Comments
 (0)