cubicweb/hooks/syncsession.py
changeset 12025 ba79f4a4f5d8
parent 12021 cc8135ecfbb8
child 12027 c62c80f20a82
equal deleted inserted replaced
12024:5f46195b9595 12025:ba79f4a4f5d8
    22 from cubicweb.predicates import is_instance
    22 from cubicweb.predicates import is_instance
    23 from cubicweb.server import hook
    23 from cubicweb.server import hook
    24 from cubicweb.entities.authobjs import user_session_cache_key
    24 from cubicweb.entities.authobjs import user_session_cache_key
    25 
    25 
    26 
    26 
    27 # take cnx and not repo because it's needed for other sessions implementation (e.g. pyramid)
    27 def get_user_sessions(cnx, user_eid):
    28 def get_user_sessions(cnx, ueid):
    28     if cnx.user.eid == user_eid:
    29     for session in cnx.repo._sessions.values():
    29         yield cnx
    30         if ueid == session.user.eid:
       
    31             yield session
       
    32 
    30 
    33 
    31 
    34 class CachedValueMixin(object):
    32 class CachedValueMixin(object):
    35     """Mixin class providing methods to retrieve some value, specified through
    33     """Mixin class providing methods to retrieve some value, specified through
    36     `value_name` attribute, in session data.
    34     `value_name` attribute, in session data.