Projet

Général

Profil

0001-sessions-use-dedicated-get_sessions_for_saml-in-SQL-.patch

Frédéric Péters, 22 mai 2018 09:02

Télécharger (2,33 ko)

Voir les différences:

Subject: [PATCH] sessions: use dedicated get_sessions_for_saml in SQL backend
 (#23972)

 wcs/qommon/sessions.py | 16 +++++++++-------
 wcs/sql.py             |  3 ++-
 2 files changed, 11 insertions(+), 8 deletions(-)
wcs/qommon/sessions.py
321 321
                d[prefix + 'user_' + k] = v
322 322
        return d
323 323

  
324
    @classmethod
325
    def get_sessions_for_saml(cls, name_identifier=Ellipsis, session_indexes=()):
326
        return (x for x in cls.values()
327
                if (not session_indexes
328
                    or x.lasso_session_index in session_indexes)
329
                   and name_identifier in (x.name_identifier or []))
330

  
324 331

  
325 332
class QommonSessionManager(QuixoteSessionManager):
326 333
    def start_request(self):
......
398 405
        if session:
399 406
            session.clean_form_tokens()
400 407

  
401
    def get_sessions_for_saml(self, name_identifier = Ellipsis, \
402
            session_indexes = ()):
403
        ret = (x for x in self.values() \
404
                if (not session_indexes \
405
                    or x.lasso_session_index in session_indexes) \
406
                   and name_identifier in (x.name_identifier or []))
407
        return ret
408
    def get_sessions_for_saml(self, name_identifier=Ellipsis, session_indexes=()):
409
        return self.session_class.get_sessions_for_saml(name_identifier, session_indexes)
408 410

  
409 411
    def get_session_for_saml(self, name_identifier = None, session_index = None):
410 412
        if session_index:
wcs/sql.py
1831 1831
            setattr(o, k, v)
1832 1832
        return o
1833 1833

  
1834
    def get_sessions_for_saml(self, name_identifier=Ellipsis, *args, **kwargs):
1834
    @classmethod
1835
    def get_sessions_for_saml(cls, name_identifier=Ellipsis, *args, **kwargs):
1835 1836
        conn, cur = get_connection_and_cursor()
1836 1837

  
1837 1838
        sql_statement = '''SELECT %s
1838
-