1505 def set_schema(self, schema): |
1505 def set_schema(self, schema): |
1506 """set the instance'schema""" |
1506 """set the instance'schema""" |
1507 if 'CWUser' in schema: # probably an empty schema if not true... |
1507 if 'CWUser' in schema: # probably an empty schema if not true... |
1508 # rql syntax trees used to authenticate users |
1508 # rql syntax trees used to authenticate users |
1509 self._passwd_rqlst = self.source.compile_rql(self.passwd_rql, self._sols) |
1509 self._passwd_rqlst = self.source.compile_rql(self.passwd_rql, self._sols) |
1510 self._auth_rqlst = self.source.compile_rql(self.auth_rql, self._sols) |
1510 if 'CWSource' in schema: |
|
1511 self._auth_rqlst = self.source.compile_rql(self.auth_rql, self._sols) |
|
1512 else: |
|
1513 self._auth_rqlst = self.source.compile_rql( |
|
1514 u'Any X WHERE X is CWUser, X login %(login)s, X upassword %(pwd)s', |
|
1515 ({'X': 'CWUser', 'P': 'Password'},)) |
1511 |
1516 |
1512 def authenticate(self, cnx, login, password=None, **kwargs): |
1517 def authenticate(self, cnx, login, password=None, **kwargs): |
1513 """return CWUser eid for the given login/password if this account is |
1518 """return CWUser eid for the given login/password if this account is |
1514 defined in this source, else raise `AuthenticationError` |
1519 defined in this source, else raise `AuthenticationError` |
1515 |
1520 |