mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-15 12:47:56 +08:00
* move common code into server, update tests and makefile remove backend directory, refactor update smoke tests
14 lines
354 B
Python
14 lines
354 B
Python
from uuid import uuid4
|
|
|
|
from flask.sessions import SessionMixin
|
|
|
|
CXGUID = "cxguid"
|
|
|
|
|
|
def get_user_id(session: SessionMixin) -> str:
|
|
""" Gets a session-persistent user id. Creates one in the Flask session if non-extant """
|
|
if CXGUID not in session:
|
|
session[CXGUID] = uuid4().hex
|
|
session.permanent = True
|
|
return session[CXGUID]
|