Skip to content

Commit 1c08f4f

Browse files
committed
fix: make no owner networks available for any user
1 parent d3b3924 commit 1c08f4f

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

compose/compose.dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ services:
8585
[
8686
"celery",
8787
"-A",
88-
"pypsa_app.backend.celery_app",
88+
"pypsa_app.backend.task_queue.task_app",
8989
"worker",
9090
"--loglevel=${CELERY_LOGLEVEL:-info}",
9191
"--concurrency=${CELERY_CONCURRENCY:-2}",

compose/compose.full.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ services:
6868
[
6969
"celery",
7070
"-A",
71-
"pypsa_app.backend.celery_app",
71+
"pypsa_app.backend.task_queue.task_app",
7272
"worker",
7373
"--loglevel=${CELERY_LOGLEVEL:-info}",
7474
"--concurrency=${CELERY_CONCURRENCY:-4}",

src/pypsa_app/backend/api/routes/networks.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
from fastapi import APIRouter, Depends, HTTPException
5+
from sqlalchemy import or_
56
from sqlalchemy.orm import Session
67

78
from pypsa_app.backend.api.deps import get_current_user, get_db, get_network_or_404
@@ -37,14 +38,12 @@ def list_networks(
3738
query = db.query(Network)
3839

3940
# When auth is enabled, filter by ownership or public networks
40-
if settings.enable_auth and user is not None:
41-
from sqlalchemy import or_
42-
41+
if settings.enable_auth:
4342
query = query.filter(
4443
or_(
4544
Network.user_id == user.id, # User's own networks
46-
Network.is_public is True,
47-
Network.user_id is None, # No owner
45+
Network.is_public == True, # noqa: E712
46+
Network.user_id == None, # noqa: E711 # Legacy networks without owner
4847
)
4948
)
5049

0 commit comments

Comments
 (0)