-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Migrate FAB POST /roles to FastAPI #57199
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
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
vincbeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the direction!
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/datamodels/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/datamodels/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/roles.py
Outdated
Show resolved
Hide resolved
|
@vincbeck, thanks for the review! Will work on this tmr |
8f6e2e1 to
5fcfe46
Compare
jason810496
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! LGTM overall.
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/tests/unit/fab/auth_manager/api_fastapi/routes/test_roles.py
Outdated
Show resolved
Hide resolved
498c519 to
7e8877e
Compare
fa0c6c1 to
e31f432
Compare
|
Love it :) |
3be15ad to
9b32f50
Compare
9b32f50 to
5b3bde0
Compare
|
Hi @jason810496 / @vincbeck / @potiuk, could you please take a look at this PR when you have a moment, thanks in advance! |
jason810496
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
vincbeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good job!
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
|
Fantastic :) |
Why
How
New FastAPI endpoint: implements
POST /auth/fab/v1/rolesusing a router registered byFabAuthManager.get_fastapi_app(). Path and success status remain compatible (200 OK). The login FastAPI module serves as structural precedent.Data models: added Pydantic models in
api_fastapi/datamodels/roles.py(RoleBody,RoleResponse, etc.). The JSON fieldactionsis preserved via aliases while internal naming uses “permissions,” mirroring the Connexion schema.Service layer:
api_fastapi/services/roles.py#create_rolereproduces the legacy flow:bulk_sync_rolesAuthorization parity: introduced a FastAPI dependency that mirrors
requires_access_custom_view("POST", RESOURCE_ROLE); unauthorized → 401, forbidden → 403 (same semantics as FAB’s Connexion layer)OpenAPI docs: response map includes 400/401/403/409 and now 500 for the rare “created-but-not-found” case, consistent with the new service behavior. (FastAPI auto-generates the schema from code.)
^ 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.