Thanks to visit codestin.com Credit goes to github.com
There was an error while loading. Please reload this page.
2 parents 22e25b3 + 4cabbe0 commit 603ef76Copy full SHA for 603ef76
3 files changed
legal-api/pyproject.toml
@@ -1,6 +1,6 @@
1
[project]
2
name = "legal-api"
3
-version = "3.1.26"
+version = "3.1.27"
4
description = ""
5
authors = [
6
{name = "thor",email = "[email protected]"}
legal-api/src/legal_api/services/filings/validations/registration.py
@@ -171,18 +171,19 @@ def validate_party(filing: dict, legal_type: str, filing_type="registration") ->
171
def validate_completing_party_name(filing: dict, filing_type="registration") -> list:
172
"""Validate the completing party name matches the submitting user's name.
173
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.
+ BC Services Card clients cannot edit the completing party (it is pre-populated from
+ their verified login), so the submitted name must match their user record. Registry and
+ SBC staff enter it manually from a paper form, API gateway users have their own workflow
+ and other login sources (e.g. BCeID) carry an editable display name rather than a verified
178
+ legal name, so those are skipped.
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
181
msg = []
182
current_user = getattr(request_ctx, "current_user", None) if has_request_context() else None
183
if (not current_user
184
or jwt.validate_roles(current_user, [STAFF_ROLE])
185
or jwt.validate_roles(current_user, [SBC_STAFF_ROLE])
- or current_user.get("loginSource") == api_login_source):
186
+ or current_user.get("loginSource") != bcsc_login_source):
187
return msg
188
189
officer = None
@@ -201,6 +202,8 @@ def validate_completing_party_name(filing: dict, filing_type="registration") ->
201
202
user_name = " ".join(" ".join(
203
filter(None, [user.firstname, user.middlename, user.lastname])
204
).split())
205
+ if not user_name:
206
+ return msg # nothing on record to compare against
207
filing_name = " ".join(" ".join(
208
filter(None, [officer.get("firstName"), officer.get("middleName"), officer.get("lastName")])
209
legal-api/tests/unit/services/filings/validations/test_registration.py
@@ -455,7 +455,8 @@ def mock_check(permissions_msg, filing_type):
455
('client_first_filing_user_created_from_token', [BASIC_USER], 'BCSC', None, ('Joe P', 'Swanson'), None),
456
('client_first_filing_token_name_mismatch', [BASIC_USER], 'BCSC', None, ('Different', 'Person'),
457
MISMATCH_ERROR),
458
- ('client_user_record_no_name', [BASIC_USER], 'BCSC', (None, None, None), None, MISMATCH_ERROR),
+ ('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),
460
('staff_skipped', [STAFF_ROLE], 'IDIR', ('Different', None, 'Person'), None, None),
461
('sbc_staff_skipped', [SBC_STAFF_ROLE], 'IDIR', ('Different', None, 'Person'), None, None),
462
('api_gw_skipped', [BASIC_USER], 'API_GW', ('Different', None, 'Person'), None, None),
0 commit comments