Skip to content

Instantly share code, notes, and snippets.

@jredrejo
Created August 13, 2020 18:23
Show Gist options
  • Save jredrejo/64ce2b0b0ac1e8ea2342a0bd8cf6e63e to your computer and use it in GitHub Desktop.
Save jredrejo/64ce2b0b0ac1e8ea2342a0bd8cf6e63e to your computer and use it in GitHub Desktop.
--- a/kolibri/plugins/oidc_provider_plugin/__init__.py
+++ b/kolibri/plugins/oidc_provider_plugin/__init__.py
@@ -1,6 +1,13 @@
+import os
+
+
def kolibri_userinfo(claims, user):
"""
Fill claims with the information available in the Kolibri database
"""
claims["name"] = user.full_name
+ COUNTRY = os.environ.get("COUNTRY", None)
+ claims["zoneinfo"] = user.facility.id
+ if COUNTRY:
+ claims["email"] = "{username}@{country}.org".format(username=user.username, country=COUNTRY)
return claims
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment