Fix user creation in FAB fails when no role specified#60015
Fix user creation in FAB fails when no role specified#60015jscheffl merged 1 commit intoapache:mainfrom
Conversation
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.
jscheffl
left a comment
There was a problem hiding this comment.
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 |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
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.
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.
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.
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
DataRequiredvalidator to the roles field inCustomUserDBModelViewto show a proper validation error instead.Testing
test_user_creation_without_role_shows_validation_errorto verify the fixScreen.Recording.2026-01-01.at.1.16.58.PM.mov
Changes
providers/fab/src/airflow/providers/fab/auth_manager/views/user.py: Addedvalidators_columnswithDataRequiredfor roles fieldproviders/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.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.