Skip to content
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

DXCDT-351: Only send changed fields when updating a user #453

Merged
merged 2 commits into from
Jan 30, 2023

Conversation

sergiught
Copy link
Contributor

@sergiught sergiught commented Jan 30, 2023

🔧 Changes

We're trying to always push an update to the Users API with name, given_name, family_name and nickname within the payload.

These unfortunately cannot be present in the payload if the connection is not a db or passwordless connection or if the Sync user profile attributes at each login is toggled on. For more info you can read auth0.com/docs/manage-users/user-accounts/user-profiles/configure-connection-sync-with-auth0.

📚 References

🔬 Testing

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)


if d.IsNewResource() {
user.ID = value.String(config.GetAttr("user_id"))
}
if d.IsNewResource() || d.HasChange("email") {
Copy link
Contributor Author

@sergiught sergiught Jan 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The d.IsNewResource is unnecessary as the d.HasChange will also trigger when this is a new resource needing to be created.

@codecov-commenter
Copy link

Codecov Report

Base: 87.16% // Head: 87.02% // Decreases project coverage by -0.15% ⚠️

Coverage data is based on head (119cf8c) compared to base (24917da).
Patch coverage: 68.96% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #453      +/-   ##
==========================================
- Coverage   87.16%   87.02%   -0.15%     
==========================================
  Files          42       42              
  Lines        9264     9277      +13     
==========================================
- Hits         8075     8073       -2     
- Misses        914      924      +10     
- Partials      275      280       +5     
Impacted Files Coverage Δ
internal/provider/resource_auth0_user.go 71.79% <68.96%> (-4.36%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sergiught sergiught marked this pull request as ready for review January 30, 2023 10:38
@sergiught sergiught requested a review from a team as a code owner January 30, 2023 10:38
@Widcket
Copy link
Contributor

Widcket commented Jan 30, 2023

Can this also be applied to other resources?

@willvedd
Copy link
Contributor

Can you provide a little context for this change? Including the issue that this solves?

@sergiught
Copy link
Contributor Author

@willvedd 🤦🏻 forgot to click update comment on the description. It's now updated.

@Widcket Yeah it could be applied to other resources and it is in various other cases, just not for every field. Other resources don't missbehave if the same elements are sent in the payload as well.

@sergiught sergiught merged commit 82000dc into main Jan 30, 2023
@sergiught sergiught deleted the issue-400/DXCDT-351-users branch January 30, 2023 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants