fix: keep legacy projects visible to non-admin users

Projects created before GNS3 3.1 have no created_by field. The project
list filtered them out for every non-superadmin user, so all old
projects disappeared from the list after an upgrade.

Fall back to the pre-3.1 ACE-only visibility rule when created_by is
not set. Projects owned by another user stay hidden.
This commit is contained in:
YueGuobin committed 2026-11-05 15:42:51 +08:00
1 parent bbb1dc4f80
commit 70ef92b55f
2 files changed
+43 -1

No files matched your search

+3 -1
View File
@@ -126,10 +126,12 @@ async def get_projects(
# Step 2: Filter direct ACE projects by created_by
# Direct project sharing is only available through resource pools
# Projects created before the created_by field existed (GNS3 < 3.1) have no
# owner: fall back to the ACE-only visibility rule instead of hiding them.
for p in controller.projects.values():
if name is not None and p.name != name:
continue
if p.id in direct_ace_ids and p.created_by == current_user.username:
if p.id in direct_ace_ids and (p.created_by is None or p.created_by == current_user.username):
if p.id not in seen_project_ids:
projects.append(p.asdict())
seen_project_ids.add(p.id)