*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects

Store the TISS ID in the user profile

Merged Moser, Maximilian requested to merge mm/tiss-id into master
4 files
+ 13
19
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -80,6 +80,12 @@ def info_handler(remote, resp):
@@ -80,6 +80,12 @@ def info_handler(remote, resp):
"external_method": remote.name,
"external_method": remote.name,
}
}
 
# store the TISS ID for users with TUW affiliation, if available
 
if (uid := user_info.get("saml_uid", None)) is not None:
 
affiliations = user_info.get("affiliation", [])
 
if any([aff.endswith("@tuwien.ac.at") for aff in affiliations]):
 
result["user"]["user_profile"]["tiss_id"] = int(uid)
 
return result
return result
@@ -214,9 +220,6 @@ def base_authorized_signup_handler(resp, remote, *args, **kwargs):
@@ -214,9 +220,6 @@ def base_authorized_signup_handler(resp, remote, *args, **kwargs):
user_info = account_info.get("user", {})
user_info = account_info.get("user", {})
new_email = user_info.get("email", user.email)
new_email = user_info.get("email", user.email)
new_profile = user_info.get("user_profile", {})
new_profile = user_info.get("user_profile", {})
new_full_name = new_profile.get("full_name")
new_given_name = new_profile.get("given_name")
new_family_name = new_profile.get("family_name")
if user.email != new_email:
if user.email != new_email:
user.email = new_email
user.email = new_email
@@ -225,21 +228,10 @@ def base_authorized_signup_handler(resp, remote, *args, **kwargs):
@@ -225,21 +228,10 @@ def base_authorized_signup_handler(resp, remote, *args, **kwargs):
# thus, we need to update the username if the email address changes
# thus, we need to update the username if the email address changes
user.username = create_username_from_info(user_info)
user.username = create_username_from_info(user_info)
# update the user's name if it has changed
# update the user's profile information if it has changed
old_profile = user.user_profile or {}
old_profile = user.user_profile or {}
_new_names = (new_given_name, new_family_name)
if new_profile and new_profile != old_profile:
_old_names = (old_profile.get("given_name"), old_profile.get("family_name"))
user.user_profile = {**old_profile, **new_profile}
if new_full_name and (
new_full_name != old_profile.get("full_name")
or _new_names != _old_names
):
user.user_profile = {
**old_profile,
"full_name": new_full_name,
"given_name": new_given_name,
"family_name": new_family_name,
}
# Hard code the affiliation to TU Wien, since we are currently
# Hard code the affiliation to TU Wien, since we are currently
# not accepting any externals. It is set on every login.
# not accepting any externals. It is set on every login.
Loading