-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assignable user and application IDs #901
Conversation
…ation services. Changed order of object assign to allow id property to be used if present instead of generating a new uuid.
Codecov Report
@@ Coverage Diff @@
## master #901 +/- ##
=======================================
Coverage 89.07% 89.07%
=======================================
Files 136 136
Lines 3688 3688
=======================================
Hits 3285 3285
Misses 403 403
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey,
the changes look good to me, I just do not understand that line change in the tests; they feel wrong to me. If you could explain (or maybe find a better way) I can get this change in!
It wasn't obvious to me at first, but by switching the order of args in the Object.assign in validateAndCreateUser, the original passed in object is not being modified anymore and instead a new pointer is returned. This affected the test because the test tries to use the original pointer instead of one returned from the insert promise. This didn't affect actual behavior because the insert functions in both the user and application services always use objects returned from promises. This does smell a bit because now a developer has to know that we're not just decorating pointers and instead we have to use the result of a promise because the pointer may have changed. Changing the order of Object.assign is not the only way this could be achieved. I really just want to be able to override the ID. Something like this would work too.
Thoughts? |
Ok, that makes sense. |
Assignable user and application IDs
Updated validateAndCreateUser & validateAndCreateApp in user & application services. Changed order of object assign to allow id property to be used if present instead of generating a new uuid.
In my case, I need to integrate with an existing PKI where client_id/secret already exist for our customers. I want to be able to assign IDs to the client application instead of generating new IDs. See the following example:
eg apps create -u <user> -p "name=<name>" -p "id=<id>"