mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-27 20:22:07 +03:00
Let auth providers get to the database
Somewhat open to abuse, but also somewhat unavoidable :/
This commit is contained in:
parent
a72e4e3e28
commit
3e0aaad190
1 changed files with 16 additions and 0 deletions
|
@ -730,6 +730,7 @@ class _AccountHandler(object):
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
|
|
||||||
self._check_user_exists = check_user_exists
|
self._check_user_exists = check_user_exists
|
||||||
|
self._store = hs.get_datastore()
|
||||||
|
|
||||||
def check_user_exists(self, user_id):
|
def check_user_exists(self, user_id):
|
||||||
"""Check if user exissts.
|
"""Check if user exissts.
|
||||||
|
@ -747,3 +748,18 @@ class _AccountHandler(object):
|
||||||
"""
|
"""
|
||||||
reg = self.hs.get_handlers().registration_handler
|
reg = self.hs.get_handlers().registration_handler
|
||||||
return reg.register(localpart=localpart)
|
return reg.register(localpart=localpart)
|
||||||
|
|
||||||
|
def run_db_interaction(self, desc, func, *args, **kwargs):
|
||||||
|
"""Run a function with a database connection
|
||||||
|
|
||||||
|
Args:
|
||||||
|
desc (str): description for the transaction, for metrics etc
|
||||||
|
func (func): function to be run. Passed a database cursor object
|
||||||
|
as well as *args and **kwargs
|
||||||
|
*args: positional args to be passed to func
|
||||||
|
**kwargs: named args to be passed to func
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred[object]: result of func
|
||||||
|
"""
|
||||||
|
return self._store.runInteraction(desc, func, *args, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue