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

Default admin check with username #2840

Merged
merged 4 commits into from
Jul 31, 2024
Merged

Conversation

CDimonaco
Copy link
Member

Description

This PR changes the way we detect if a user is the default admin.
We used to check against the user id, checking from id == 1

We change the strategy in order to check against the username, the guarantees are the same but we don't assume the user id, this will be useful also in future scenarios when the admin will come from an external IDP and we can't be sure if it's the user with id 1 in our database.

How was this tested?

Automated tests

@CDimonaco CDimonaco added enhancement New feature or request elixir Pull requests that update Elixir code labels Jul 30, 2024
@CDimonaco CDimonaco self-assigned this Jul 30, 2024
@CDimonaco CDimonaco force-pushed the default_admin_check_with_username branch from a8ba132 to c41e06e Compare July 30, 2024 15:37
Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

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

The idea is needed, i understand that, but the changes in the users file makes me so sad.
If there is not any other alternative, we will need to go this way, but it looks so ugly codewise 😅

Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

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

Hey @CDimonaco
It looks good to me.
Simply a comment about making the admin_username function maybe private.

About the ugliness, i understand that there must not be any other option.
If you researched it, and there isn't, go ahead. It is what it is

@CDimonaco CDimonaco merged commit 8233e71 into main Jul 31, 2024
24 of 25 checks passed
@CDimonaco CDimonaco deleted the default_admin_check_with_username branch July 31, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elixir Pull requests that update Elixir code enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants