Skip to content

Commit

Permalink
Remove customSettings key in unathenticated responses
Browse files Browse the repository at this point in the history
  • Loading branch information
swainn committed Jan 5, 2024
1 parent 8ec874f commit 4707fac
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tethys_portal/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ def get_app(request, app):
except TethysApp.DoesNotExist:
return JsonResponse({"error": f'Could not find app "{app}".'})

custom_settings = {}
if request.user.is_authenticated:
custom_settings = {
s.name: {
"type": s.type,
"value": s.get_value(),
}
for s in app.custom_settings
}

metadata = {
"title": app.name,
"description": app.description,
Expand All @@ -65,6 +55,15 @@ def get_app(request, app):
"exitUrl": reverse("app_library"),
"rootUrl": reverse(app.index_url),
"settingsUrl": f'{reverse("admin:index")}tethys_apps/tethysapp/{ app.id }/change/',
"customSettings": custom_settings,
}

if request.user.is_authenticated:
metadata["customSettings"] = {
s.name: {
"type": s.type,
"value": s.get_value(),
}
for s in app.custom_settings
}

return JsonResponse(metadata)

0 comments on commit 4707fac

Please sign in to comment.