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

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

Open
wants to merge 2 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

Merging #683 (3cfc739) into master (f27461d) will decrease coverage by 0.06%.
The diff coverage is 10.00%.

@@            Coverage Diff             @@
##           master     #683      +/-   ##
==========================================
- Coverage   77.01%   76.94%   -0.07%     
==========================================
  Files         319      319              
  Lines        9677     9687      +10     
  Branches     1036     1040       +4     
==========================================
+ Hits         7453     7454       +1     
- Misses       2072     2081       +9     
  Partials      152      152              
Flag Coverage Δ
unittests 76.94% <10.00%> (-0.07%) ⬇️

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

Impacted Files Coverage Δ
social_core/pipeline/__init__.py 100.00% <ø> (ø)
social_core/pipeline/social_auth.py 78.18% <10.00%> (-15.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f27461d...3cfc739. Read the comment docs.

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