summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-03-01 13:28:17 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-03-01 15:17:14 +0100
commit8966a1486c031478f3c9c35d9d2914a96782ae53 (patch)
tree6354b2308bbb4ef21b0d179815e7ca742d7a4b05 /server
parent500dae272daabdb5e9272d3e54111aea5e109c3b (diff)
Support experiments field for SAML logins
Diffstat (limited to 'server')
-rw-r--r--server/user_session.py4
1 files changed, 3 insertions, 1 deletions
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]