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

Add last_name to ApiKey users #37234

Merged
merged 1 commit into from Jan 4, 2024
Merged

Conversation

johnswanson
Copy link
Contributor

@johnswanson johnswanson commented Jan 3, 2024

When we generate a :common_name on Users, we check for the presence of both first_name and last_name. If either is nil, we don't generate a common_name.

ApiKey users only have one name (the name of the ApiKey itself) but we should set the last_name to an empty string. This way, the common name will still be generated.

Because the metabase.models.user/insert-new-user! function requires a NonBlankString for first_name and last_name if they're present, I went back to calling t2/insert-returning-instances! directly.

@metabase-bot metabase-bot bot added the .Team/AdminWebapp Admin and Webapp team label Jan 3, 2024
@johnswanson johnswanson added the no-backport Do not backport this PR to any branch label Jan 3, 2024
When we generate a `:common_name` on Users, we check for the presence of
both `first_name` and `last_name`. If either is `nil`, we don't generate
a `common_name`.

ApiKey users only have one name (the name of the ApiKey itself) but we
should set the `last_name` to an empty string. This way, the common name
will still be generated.

Because the `metabase.models.user/insert-new-user!` function requires a
NonBlankString for `first_name` and `last_name` if they're present, I
went back to calling `t2/insert-returning-instances!` directly.
@johnswanson johnswanson force-pushed the add-last-name-to-api-key-users branch from 8e25122 to 06d6253 Compare January 3, 2024 19:10
@johnswanson johnswanson requested a review from a team January 3, 2024 20:12
@johnswanson johnswanson merged commit b8a4e0d into master Jan 4, 2024
103 of 104 checks passed
@johnswanson johnswanson deleted the add-last-name-to-api-key-users branch January 4, 2024 18:11
Copy link

github-actions bot commented Jan 4, 2024

@johnswanson Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

@johnswanson johnswanson added this to the 0.49 milestone Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/AdminWebapp Admin and Webapp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants