Skip to content

Commit

Permalink
HYP-280 - Make user's token available for templates
Browse files Browse the repository at this point in the history
  • Loading branch information
b32147 committed Sep 13, 2023
1 parent 24a22e1 commit f806aa4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ app/db.sqlite3
app/hypatio/local_settings.py
.vscode/settings.json
backup
infrastructure
11 changes: 10 additions & 1 deletion app/hypatio/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from django.shortcuts import render
from django.utils.functional import SimpleLazyObject
from dbmi_client.authn import get_jwt

from hypatio.auth0authenticate import public_user_auth_and_jwt
from projects.models import Group, DataProject
Expand Down Expand Up @@ -43,6 +44,14 @@ def group_context():
"active_group": active_group,
}

def user_context():

# Check for signed in user
return {
"jwt": get_jwt(request),
}

return {
"navigation": SimpleLazyObject(group_context)
"navigation": SimpleLazyObject(group_context),
"dbmiuser": SimpleLazyObject(user_context),
}

0 comments on commit f806aa4

Please sign in to comment.