# HG changeset patch # User Julien Cristau # Date 1457369600 -3600 # Node ID 8448a8c5cca4e4bfb44620c5a6608d7a679f568f # Parent 79b124ec1157ca4bcb3bac3b2b78db36eda61316 [server/sources] Fix authenticate on pre-3.10 database When migrating from a pre-3.10 database, the CWSource entity type and cw_source relation type are not known, but authenticate should still work to be able to add them. diff -r 79b124ec1157 -r 8448a8c5cca4 server/sources/native.py --- a/server/sources/native.py Tue Feb 16 18:17:35 2016 +0100 +++ b/server/sources/native.py Mon Mar 07 17:53:20 2016 +0100 @@ -1486,7 +1486,12 @@ if 'CWUser' in schema: # probably an empty schema if not true... # rql syntax trees used to authenticate users self._passwd_rqlst = self.source.compile_rql(self.passwd_rql, self._sols) - self._auth_rqlst = self.source.compile_rql(self.auth_rql, self._sols) + if 'CWSource' in schema: + self._auth_rqlst = self.source.compile_rql(self.auth_rql, self._sols) + else: + self._auth_rqlst = self.source.compile_rql( + u'Any X WHERE X is CWUser, X login %(login)s, X upassword %(pwd)s', + ({'X': 'CWUser', 'P': 'Password'},)) def authenticate(self, cnx, login, password=None, **kwargs): """return CWUser eid for the given login/password if this account is