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

πŸ§‘β€πŸ’»(models) improve user str representation #177

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

mjeammet
Copy link
Member

@mjeammet mjeammet commented Apr 5, 2024

Purpose

As suggested in #106 : Improve user model str representation.

Implementation

EDIT after Identity model removal :

  • displays name if user has a name
  • displays email if user has no name but an email
  • displays sub otherwise

@mjeammet mjeammet self-assigned this Apr 5, 2024
@mjeammet mjeammet requested a review from lebaudantoine April 5, 2024 15:20
@sampaccoud
Copy link
Member

@mjeammet I think technically, on the "sub" field is really needed to identify the user. That was the idea behind the decision to make the other fields like name and email optional.

@mjeammet mjeammet linked an issue Apr 8, 2024 that may be closed by this pull request
@mjeammet
Copy link
Member Author

mjeammet commented Apr 8, 2024

@mjeammet I think technically, on the "sub" field is really needed to identify the user. That was the idea behind the decision to make the other fields like name and email optional.

I wonder if the sub isn't necessarily linked to an email adress. Like, is there any identity provider not using email/password as main mean of identifcation ?

More importantly here ; do we want to allow linking a sub to an adress email different than the one used right before, to log in ? Actually, I guess we do. What do you think ?

@mjeammet
Copy link
Member Author

mjeammet commented Apr 10, 2024

In the end, I moved identity-related complexity to Identity's representation.
In the user model, I return str(main_identity) if there is one, and admin_email / uuid otherwise.

@mjeammet mjeammet requested a review from sampaccoud April 10, 2024 16:46
@mjeammet mjeammet marked this pull request as draft June 21, 2024 16:18
@mjeammet mjeammet force-pushed the improve-user-representation branch from d8f63c2 to 219092d Compare July 3, 2024 09:33
@mjeammet mjeammet requested a review from sdemagny July 3, 2024 09:41
@mjeammet mjeammet force-pushed the improve-user-representation branch from 219092d to 9bc3128 Compare July 3, 2024 09:47
@mjeammet mjeammet marked this pull request as ready for review July 3, 2024 09:48
@mjeammet mjeammet force-pushed the improve-user-representation branch 2 times, most recently from c1ad82a to 408dc16 Compare July 3, 2024 14:55
Improve user model str representation to display name or email
if provided. Otherwise, returns sub as last resort.
@mjeammet mjeammet force-pushed the improve-user-representation branch from 408dc16 to 2d9386a Compare July 3, 2024 15:00
@mjeammet mjeammet merged commit 66300ac into main Jul 3, 2024
15 checks passed
@mjeammet mjeammet deleted the improve-user-representation branch July 3, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance user string representation
3 participants