@@ -41,7 +41,7 @@ def router_read_one[T: BaseModel, I: Identifiable](
4141 id_ : uuid .UUID ,
4242 db : Session ,
4343 db_model_class : type [I ],
44- authorized_project_id : uuid . UUID | None ,
44+ user_context : UserContext | None ,
4545 response_schema_class : SupportsModelValidate [T ],
4646 apply_operations : ApplyOperations [I ] | None ,
4747) -> T :
@@ -51,19 +51,21 @@ def router_read_one[T: BaseModel, I: Identifiable](
5151 id_: id of the entity to read.
5252 db: database session.
5353 db_model_class: database model class.
54- authorized_project_id: id of the authorized project.
54+ user_context: the user context with project id and user information .
5555 response_schema_class: Pydantic schema class for the returned data.
5656 apply_operations: transformer function that modifies the select query.
5757
5858 Returns:
5959 the model data as a Pydantic model.
6060 """
6161 query = sa .select (db_model_class ).where (db_model_class .id == id_ )
62- if authorized_project_id and (
62+ if user_context and (
6363 id_model_class := get_declaring_class (db_model_class , "authorized_project_id" )
6464 ):
6565 query = constrain_to_accessible_entities (
66- query , authorized_project_id , db_model_class = id_model_class
66+ query = query ,
67+ project_id = user_context .project_id ,
68+ db_model_class = id_model_class ,
6769 )
6870 if apply_operations :
6971 query = apply_operations (query )
0 commit comments