mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-20 05:05:14 +02:00
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:
2 files changed
+43
-1
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user