fix: attribute duplicated project to the user who duplicated it

duplicate() kept the original author in created_by. The project list
filters on created_by, so a non-admin user could not see the copy they
just made. Pass the caller through both duplication paths, the same way
import already does since #3017.
This commit is contained in:
YueGuobin committed 2026-11-05 19:22:27 +08:00
1 parent 7230e86c15
commit 517b0b0d85
4 files changed
+39 -5

No files matched your search

+5 -1
View File
@@ -886,7 +886,11 @@ async def duplicate_project(
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
reset_mac_addresses = project_data.reset_mac_addresses
new_project = await project.duplicate(name=project_data.name, reset_mac_addresses=reset_mac_addresses)
new_project = await project.duplicate(
name=project_data.name,
reset_mac_addresses=reset_mac_addresses,
user=current_user.username,
)
# Add the new project in the same resource pools if the duplicated project belongs to any
if pool_memberships: