-
Notifications
You must be signed in to change notification settings - Fork 147
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
Potential data loss when saving app profile fields #386
Comments
@cmc333333 do u have shouldn't it be async with Client() as client:
assignment, _, _ = await client.get_application_group_assignment(APP_ID, GROUP_ID)
# should be a no-op:
await client.create_application_group_assignment(APP_ID, GROUP_ID, assignment) |
Sorry, yes, please assume there was an Also, as written, I think the call would error out rather than silently fail (Okta rejects the |
how?
where? here's my repro code import okta.client
import asyncio
APP_ID = '0oa...'
GROUP_ID = '00g...'
async def main():
async with okta.client.Client() as client:
assignment, _, _ = await client.get_application_group_assignment(APP_ID, GROUP_ID)
print(assignment.profile)
await client.create_application_group_assignment(APP_ID, GROUP_ID, assignment)
asyncio.run(main()) i have attributes if i set logging enabled to true, i get
it sounds like the whole snake_case to camelCase conversion shouldn't be done (not that it should be converted and then converted back again) |
okta-sdk-python/okta/models/group_profile.py Lines 45 to 49 in d896f65
okta-sdk-python/okta/models/user_profile.py Lines 132 to 136 in d896f65
I've not dug in enough to understand how that logic's injected, though -- the call to
Exactly. I think there are weird edge cases where setting
That seems like a fine solution to me! We're working around this by using the response object (second element of the return value) directly. |
yes, and no. i can't repro your code without async and await (i'm not going to use a2s). a2s might have bugs, too. i'd recommend posting code just using the sdk (i'll take a look at the rest of your response and reply) |
I'm glad you were able to see through my buggy code to the underlying problem. |
ooh, i can async def main():
async with okta.client.Client() as client:
assignment, response, error = await client.get_application_group_assignment(APP_ID, GROUP_ID)
print(assignment.profile)
# should be a no-op:
assignment, response, error = await client.create_application_group_assignment(APP_ID, GROUP_ID, assignment)
print(error) i've looked the sdk code. still haven't found anything, but this is promising okta-sdk-python/okta/api_response.py Lines 136 to 144 in d896f65
|
Hello!
We have an app with a custom schema, including some fields that are
snake_cased
. Say we've already assigned some properties toGROUP_ID
for appAPP_ID
. When we run:we were seeing our attributes cleared out. Digging in, it seems that
assignment.profile
has converted the field names tocamelCase
(here, I think). This was particularly insidious as our application wasn't modifying thesnake_cased
fields.I'd think the "right" thing to do here would be for profiles (user, group, application) to skip
camelCasing
-- it looks like there's already some logic inUserProfile
to do something in this vein.The text was updated successfully, but these errors were encountered: