forked from bcgov/common-hosted-form-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: FORMS-1012 make add team member in team management case insensit…
…ive (bcgov#1475) * Fix Team management - Add a new member - type BCEID - Business/Basic textfield is case sensitive - FORMS-1012 Fix copy submission option not visible for submissions other than SUBMITTED state. - FORMS-1277 * Fix Team management - Add a new member - type BCEID - Business/Basic textfield is case sensitive - FORMS-1012 Fix copy submission option not visible for submissions other than SUBMITTED state. - FORMS-1277 * Fix PR comments. * Fix unit test cases. * Fix PR comments, update query builder to match variables. --------- Co-authored-by: “bhuvan-aot” <“[email protected]”>
- Loading branch information
1 parent
27d0105
commit 267c9d6
Showing
11 changed files
with
186 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
89 changes: 89 additions & 0 deletions
89
app/src/db/migrations/20240806171846_update_identity_provider_extra.js
This file contains 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,89 @@ | ||
const BCEID_EXTRAS_EXACT_IGNORE_CASE = { | ||
formAccessSettings: 'idim', | ||
addTeamMemberSearch: { | ||
text: { | ||
minLength: 6, | ||
message: 'trans.manageSubmissionUsers.searchInputLength', | ||
}, | ||
email: { | ||
exact: true, | ||
message: 'trans.manageSubmissionUsers.exactBCEIDSearch', | ||
}, | ||
}, | ||
userSearch: { | ||
filters: [ | ||
{ name: 'filterIdpUserId', param: 'idpUserId', required: 0 }, | ||
{ name: 'filterIdpCode', param: 'idpCode', required: 0 }, | ||
{ name: 'filterUsername', param: 'username', required: 2, exact: true, caseSensitive: false }, | ||
{ name: 'filterFullName', param: 'fullName', required: 0 }, | ||
{ name: 'filterFirstName', param: 'firstName', required: 0 }, | ||
{ name: 'filterLastName', param: 'lastName', required: 0 }, | ||
{ name: 'filterEmail', param: 'email', required: 2, exact: true, caseSensitive: false }, | ||
{ name: 'filterSearch', param: 'search', required: 0 }, | ||
], | ||
detail: 'Could not retrieve BCeID users. Invalid options provided.', | ||
}, | ||
}; | ||
|
||
const BCEID_EXTRAS_EXACT = { | ||
formAccessSettings: 'idim', | ||
addTeamMemberSearch: { | ||
text: { | ||
minLength: 6, | ||
message: 'trans.manageSubmissionUsers.searchInputLength', | ||
}, | ||
email: { | ||
exact: true, | ||
message: 'trans.manageSubmissionUsers.exactBCEIDSearch', | ||
}, | ||
}, | ||
userSearch: { | ||
filters: [ | ||
{ name: 'filterIdpUserId', param: 'idpUserId', required: 0 }, | ||
{ name: 'filterIdpCode', param: 'idpCode', required: 0 }, | ||
{ name: 'filterUsername', param: 'username', required: 2, exact: true }, | ||
{ name: 'filterFullName', param: 'fullName', required: 0 }, | ||
{ name: 'filterFirstName', param: 'firstName', required: 0 }, | ||
{ name: 'filterLastName', param: 'lastName', required: 0 }, | ||
{ name: 'filterEmail', param: 'email', required: 2, exact: true }, | ||
{ name: 'filterSearch', param: 'search', required: 0 }, | ||
], | ||
detail: 'Could not retrieve BCeID users. Invalid options provided.', | ||
}, | ||
}; | ||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.up = function (knex) { | ||
return Promise.resolve().then(() => | ||
knex.schema | ||
.hasTable('identity_provider') | ||
.then(() => | ||
knex('identity_provider').where({ code: 'bceid-business' }).update({ | ||
extra: BCEID_EXTRAS_EXACT_IGNORE_CASE, | ||
}) | ||
) | ||
.then(() => | ||
knex('identity_provider').where({ code: 'bceid-basic' }).update({ | ||
extra: BCEID_EXTRAS_EXACT_IGNORE_CASE, | ||
}) | ||
) | ||
); | ||
}; | ||
exports.down = function (knex) { | ||
return Promise.resolve().then(() => | ||
knex.schema | ||
.hasTable('identity_provider') | ||
.then(() => | ||
knex('identity_provider').where({ code: 'bceid-business' }).update({ | ||
extra: BCEID_EXTRAS_EXACT, | ||
}) | ||
) | ||
.then(() => | ||
knex('identity_provider').where({ code: 'bceid-basic' }).update({ | ||
extra: BCEID_EXTRAS_EXACT, | ||
}) | ||
) | ||
); | ||
}; |
This file contains 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 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 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 |
---|---|---|
|
@@ -139,15 +139,15 @@ describe('idpService', () => { | |
expect(MockModel.query).toBeCalledTimes(1); | ||
expect(MockModel.modify).toBeCalledTimes(9); | ||
expect(MockModel.modify).toBeCalledWith('filterIdpCode', 'idir'); | ||
expect(MockModel.modify).toBeCalledWith('filterEmail', '[email protected]', false); | ||
expect(MockModel.modify).toBeCalledWith('filterEmail', '[email protected]', false, false); | ||
}); | ||
|
||
it('should return a customized user search', async () => { | ||
const s = await idpService.userSearch({ idpCode: 'bceid-business', email: '[email protected]' }); | ||
expect(s).toBeFalsy(); | ||
expect(MockModel.query).toBeCalledTimes(1); | ||
expect(MockModel.modify).toBeCalledWith('filterIdpCode', 'bceid-business'); | ||
expect(MockModel.modify).toBeCalledWith('filterEmail', '[email protected]', true); | ||
expect(MockModel.modify).toBeCalledWith('filterIdpCode', 'bceid-business', false, true); | ||
expect(MockModel.modify).toBeCalledWith('filterEmail', '[email protected]', true, false); | ||
expect(MockModel.modify).toBeCalledTimes(9); | ||
}); | ||
|
||
|
This file contains 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.