Skip to content

By default, set the fullname from first+last and vice-versa #683

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dehnert
Copy link
Contributor

@dehnert dehnert commented May 8, 2022

Fixes #678.

Proposed changes

As described in #678 , when the SAML backend supplies a fullname, it's desirable for my Django user to have first_name and last_name set. This changes PSA so if fullname is set (in, eg, a SAML response) but not first_name/last_name, by default it generates a first_name and last_name automatically. Similarly, it does the reverse transformation when fullname is missing. IMO this is a net improvement, but obviously there's questions like "should this be enabled by default", "should it be in the default pipeline", etc. -- I'm happy to tweak this to make it fit the team's design goals better. Assuming the concept makes sense, I can write docs.

Types of changes

Please check the type of change your PR introduces:

  • Release (new release request)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (PEP8, lint, formatting, renaming, etc)
  • Refactoring (no functional changes, no api changes)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Build related changes (build process, tests runner, etc)
  • Other (please describe):

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.

  • [X?] Lint and unit tests pass locally with my changes -- running tox reports an error in test_dummy both before and after my change
  • I have added tests that prove my fix is effective or that my feature works

Other information

Any other information that is important to this PR such as screenshots of how
the component looks before and after the change.

@codecov
Copy link

codecov bot commented May 8, 2022

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 77.63%. Comparing base (2a99653) to head (532ee57).

Files with missing lines Patch % Lines
social_core/pipeline/social_auth.py 10.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #683      +/-   ##
==========================================
- Coverage   77.69%   77.63%   -0.07%     
==========================================
  Files         353      353              
  Lines       10877    10887      +10     
  Branches      489      493       +4     
==========================================
+ Hits         8451     8452       +1     
- Misses       2250     2259       +9     
  Partials      176      176              
Flag Coverage Δ
unittests 77.63% <10.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

first, _space, last = details['fullname'].rpartition(' ')
details['first_name'] = first.strip()
details['last_name'] = last.strip()
print(f"end social_names {details=}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I'll need to remove this, but I'd like to confirm that the general direction seems good before I do the cleanup.)

@dehnert
Copy link
Contributor Author

dehnert commented Sep 18, 2022

Any thoughts on this general feature?

@dehnert
Copy link
Contributor Author

dehnert commented Jul 13, 2024

Any thoughts?

@nijel
Copy link
Member

nijel commented Jul 15, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Use fullname and first_name/last_name ~interchangeably
2 participants