sjyangkevin commented on code in PR #54308:
URL: https://github.com/apache/airflow/pull/54308#discussion_r2275474942
##########
airflow-core/docs/img/airflow_erd.svg:
##########
Review Comment:
the `hitl_detail` relation should include `respondents` as a new column, but
it is not shown in the diagram. Will look into it.
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -119,6 +119,18 @@ def _update_hitl_detail(
"and is not allowed to write again.",
)
+ user_id = user.get_id()
+
+ if hitl_detail_model.respondents:
+ if isinstance(user_id, int):
+ # FabAuthManager (ab_user) store user id as integer, but common
interface is string type
+ user_id = str(user_id)
+ if user_id not in hitl_detail_model.respondents:
+ log.error("User=%s[%s] is not a respondent for the task", user_id,
type(user_id))
+ raise HTTPException(
+ status.HTTP_403_FORBIDDEN, f"User={user_id} is not a
respondent for the task."
+ )
+
hitl_detail_model.user_id = user.get_id()
Review Comment:
Since the type conversion is only for checking, probably better to get the
user_id from the `get_id()` method
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -119,6 +119,18 @@ def _update_hitl_detail(
"and is not allowed to write again.",
)
+ user_id = user.get_id()
+
+ if hitl_detail_model.respondents:
+ if isinstance(user_id, int):
Review Comment:
maybe related to this issue: https://github.com/apache/airflow/issues/54298
### the fab auth manager ID column
https://github.com/apache/airflow/blob/5f29f4ec5edcf8ff4f1dd8726cccb066263ee5b0/providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py#L209
https://github.com/apache/airflow/blob/5f29f4ec5edcf8ff4f1dd8726cccb066263ee5b0/providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py#L291-L292
### the interface
https://github.com/apache/airflow/blob/5f29f4ec5edcf8ff4f1dd8726cccb066263ee5b0/airflow-core/src/airflow/api_fastapi/auth/managers/models/base_user.py#L26-L27
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]