feat: upsert user by oidc - #1224
Conversation
40650a0 to
e31bb22
Compare
e31bb22 to
55190f1
Compare
a0abcdf to
fb3d7db
Compare
| BEGIN | ||
| IF register_patch('AddUniqueConstraintToOidcSub.sql', 'yoganandanpandiyan', 'Unique constraint', '2025-10-13') THEN | ||
| BEGIN | ||
| ALTER TABLE users ADD CONSTRAINT unique_oidc_sub UNIQUE (oidc_sub); |
There was a problem hiding this comment.
This patch is failing on the stfc db as we have the empty string as the stub on most records. Can we add a step in the to change the stub to null or the user number?
There was a problem hiding this comment.
Also the db seeds were updated 5 months ago to change the oidc_sub of the dummy users 100-102 before they were all 99999 so any database made before that would also fail this patch.
…x to the non empty duplicate values to facilitate smooth process of enforing uniqueness to the oidc_sub
…re into SWAP-5056-user-office-one-identity-synchronisation
…github.com:UserOfficeProject/user-office-core into SWAP-5056-user-office-one-identity-synchronisation
…github.com:UserOfficeProject/user-office-core into SWAP-5056-user-office-one-identity-synchronisation
…github.com:UserOfficeProject/user-office-core into SWAP-5056-user-office-one-identity-synchronisation
…github.com:UserOfficeProject/user-office-core into SWAP-5056-user-office-one-identity-synchronisation
…github.com:UserOfficeProject/user-office-core into SWAP-5056-user-office-one-identity-synchronisation
3c8f862 to
3a7e32f
Compare
ed2d129 to
827199f
Compare
827199f to
d470d3d
Compare
|
@TCMeldrum Could you take a look at this again, as there were few undoes and some optimisation. |
| SET oidc_sub = NULL | ||
| WHERE oidc_sub = ''; | ||
|
|
||
| -- Handle duplicate oidc_sub values by appending a unique suffix. ex., '_1', '_2', etc. |
There was a problem hiding this comment.
I’m a little bit concerned about this. We silently mutate rows, can’t we just let the update fail and manually fix the rows that have the same values?
Instead of trying to be smart, we could select the duplicate values and, if any are found, raise a clear error indicating where the duplicates are and that they need to be fixed.
…y duplicate oidc_sub
TCMeldrum
left a comment
There was a problem hiding this comment.
With manually resoliving our duplicates it looks fine to me. Is there anyway we can tag the next release to remind us this manual check needs to happen?
|
|
2 similar comments
|
|
|
|
|
|
|
|
Description
Added User Upsert Mutation that handle both Creation and Update of User by OIDC Sub. This endpoint is created for external purpose used by the Authentication Identity team to sync the users in the user office.
Motivation and Context
Synchronization with One Identity Systems(Authentication)
How Has This Been Tested
Attached Unit Test Cases
Fixes
Changes
Depends on
Tests included/Docs Updated?