From 8966a1486c031478f3c9c35d9d2914a96782ae53 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 1 Mar 2016 13:28:17 +0100 Subject: Support experiments field for SAML logins --- server/user_session.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/user_session.py b/server/user_session.py index 7860022..21c3009 100644 --- a/server/user_session.py +++ b/server/user_session.py @@ -67,6 +67,7 @@ class UserSession(object): self.is_admin = False self._lang_session = None self.settings = {} + self.experiments = [] self.last_access = int(time.time()) # resolution: 1 second with module_access_lock: sessions[self.sid] = self @@ -163,12 +164,13 @@ class UserSession(object): try: cur = conn.cursor() try: - cur.execute('update codeq_user set name = coalesce(%s, name), email = coalesce(%s, email), saml_data = %s, last_login = %s where username = %s and password is null returning id, gui_lang, date_joined, robot_address, gui_layout, email', (name, email, psycopg2.extras.Json(saml_data), str(now), eduPersonPrincipalName)) + cur.execute('update codeq_user set name = coalesce(%s, name), email = coalesce(%s, email), saml_data = %s, last_login = %s where username = %s and password is null returning id, gui_lang, date_joined, robot_address, gui_layout, email, experiments', (name, email, psycopg2.extras.Json(saml_data), str(now), eduPersonPrincipalName)) row = cur.fetchone() if row: self.uid = row[0] self.username = eduPersonPrincipalName self.settings = {'gui_lang': row[1], 'robot_address': row[3], 'gui_layout': row[4]} + self.experiments = row[6] if row[6] else [] date_joined = row[2] if email is None: email = row[5] -- cgit v1.2.1