Assign client IP address to session, for sake of data versioning

This commit is contained in:
Lance Edgar 2019-06-15 19:02:51 -05:00
parent 558e127caa
commit 48e28a1ba4

View file

@ -75,8 +75,12 @@ def new_request(event):
if uuid: if uuid:
request.user = Session.query(model.User).get(uuid) request.user = Session.query(model.User).get(uuid)
if request.user: if request.user:
# assign user to the session, for sake of versioning
Session().set_continuum_user(request.user) Session().set_continuum_user(request.user)
# assign client IP address to the session, for sake of versioning
Session().continuum_remote_addr = request.client_addr
request.is_admin = bool(request.user) and request.user.is_admin() request.is_admin = bool(request.user) and request.user.is_admin()
request.is_root = request.is_admin and request.session.get('is_root', False) request.is_root = request.is_admin and request.session.get('is_root', False)