Refactor read_flows function to include current user's flows
This commit is contained in:
parent
1d9aed286a
commit
a060b8de18
1 changed files with 6 additions and 2 deletions
|
|
@ -57,7 +57,11 @@ def read_flows(
|
||||||
try:
|
try:
|
||||||
auth_settings = settings_service.auth_settings
|
auth_settings = settings_service.auth_settings
|
||||||
if auth_settings.AUTO_LOGIN:
|
if auth_settings.AUTO_LOGIN:
|
||||||
flows = session.exec(select(Flow).where(Flow.user_id == None)).all()
|
flows = session.exec(
|
||||||
|
select(Flow).where(
|
||||||
|
Flow.user_id == None | Flow.user_id == current_user.id
|
||||||
|
)
|
||||||
|
).all() # noqa
|
||||||
else:
|
else:
|
||||||
flows = current_user.flows
|
flows = current_user.flows
|
||||||
|
|
||||||
|
|
@ -67,7 +71,7 @@ def read_flows(
|
||||||
try:
|
try:
|
||||||
example_flows = session.exec(
|
example_flows = session.exec(
|
||||||
select(Flow).where(
|
select(Flow).where(
|
||||||
Flow.user_id == None, Flow.folder == STARTER_FOLDER_NAME
|
Flow.user_id == None, Flow.folder == STARTER_FOLDER_NAME # noqa
|
||||||
)
|
)
|
||||||
).all() # noqa
|
).all() # noqa
|
||||||
for example_flow in example_flows:
|
for example_flow in example_flows:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue