Skip to content

Conversation

@junaiddshaukat
Copy link
Contributor

Fixes #59963

Problem

When creating a user in FAB without selecting a role, the system was throwing HTTP 500 error due to KeyError: 'groups'.

Solution

This fix adds DataRequired validator to the roles field in CustomUserDBModelView to show a proper validation error instead.

Testing

  • Added unit test test_user_creation_without_role_shows_validation_error to verify the fix
Screen.Recording.2026-01-01.at.1.16.58.PM.mov

Changes

  • providers/fab/src/airflow/providers/fab/auth_manager/views/user.py: Added validators_columns with DataRequired for roles field
  • providers/fab/tests/unit/fab/www/views/test_views_custom_user_views.py: Added regression test

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

Fixes apache#59963

When creating a user in FAB without selecting a role, the system was
throwing HTTP 500 error due to KeyError: 'groups'. This fix adds
DataRequired validator to the roles field in CustomUserDBModelView
to show a proper validation error instead.
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Looks priomising. When re-testing found another problem for which I'll open a bug in a moment.
Let's make CI green and then LGMT!

@junaiddshaukat
Copy link
Contributor Author

Thanks for the fix! Looks priomising. When re-testing found another problem for which I'll open a bug in a moment. Let's make CI green and then LGMT!

Sure, I would love to fix that bug too. Just assign that bug to me after creating. Thanks

@jscheffl
Copy link
Contributor

jscheffl commented Jan 1, 2026

Thanks for the fix! Looks priomising. When re-testing found another problem for which I'll open a bug in a moment. Let's make CI green and then LGMT!

Sure, I would love to fix that bug too. Just assign that bug to me after creating. Thanks

It is: #60017

@jscheffl jscheffl merged commit 83afc02 into apache:main Jan 1, 2026
85 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 1, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

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.

User creation in Fab fails when no role specified

2 participants