mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Register a user account for the AS when the AS registers. Add 'sender' column to AS table.
This commit is contained in:
parent
73a680b2a8
commit
ac3183caaa
@ -35,10 +35,11 @@ class ApplicationService(object):
|
|||||||
NS_LIST = [NS_USERS, NS_ALIASES, NS_ROOMS]
|
NS_LIST = [NS_USERS, NS_ALIASES, NS_ROOMS]
|
||||||
|
|
||||||
def __init__(self, token, url=None, namespaces=None, hs_token=None,
|
def __init__(self, token, url=None, namespaces=None, hs_token=None,
|
||||||
txn_id=None):
|
sender=None, txn_id=None):
|
||||||
self.token = token
|
self.token = token
|
||||||
self.url = url
|
self.url = url
|
||||||
self.hs_token = hs_token
|
self.hs_token = hs_token
|
||||||
|
self.sender = sender
|
||||||
self.namespaces = self._check_namespaces(namespaces)
|
self.namespaces = self._check_namespaces(namespaces)
|
||||||
self.txn_id = txn_id
|
self.txn_id = txn_id
|
||||||
|
|
||||||
|
@ -52,8 +52,14 @@ class ApplicationServicesHandler(object):
|
|||||||
"Consult the home server admin.",
|
"Consult the home server admin.",
|
||||||
errcode=Codes.FORBIDDEN
|
errcode=Codes.FORBIDDEN
|
||||||
)
|
)
|
||||||
logger.info("Updating application service info...")
|
|
||||||
app_service.hs_token = self._generate_hs_token()
|
app_service.hs_token = self._generate_hs_token()
|
||||||
|
|
||||||
|
# create a sender for this application service which is used when
|
||||||
|
# creating rooms, etc..
|
||||||
|
account = yield self.hs.get_handlers().registration_handler.register()
|
||||||
|
app_service.sender = account[0]
|
||||||
|
|
||||||
yield self.store.update_app_service(app_service)
|
yield self.store.update_app_service(app_service)
|
||||||
defer.returnValue(app_service)
|
defer.returnValue(app_service)
|
||||||
|
|
||||||
|
@ -130,8 +130,9 @@ class ApplicationServiceStore(SQLBaseStore):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
txn.execute(
|
txn.execute(
|
||||||
"UPDATE application_services SET url=?, hs_token=? WHERE id=?",
|
"UPDATE application_services SET url=?, hs_token=?, sender=? "
|
||||||
(service.url, service.hs_token, as_id,)
|
"WHERE id=?",
|
||||||
|
(service.url, service.hs_token, service.sender, as_id,)
|
||||||
)
|
)
|
||||||
# cleanup regex
|
# cleanup regex
|
||||||
txn.execute(
|
txn.execute(
|
||||||
|
@ -18,6 +18,7 @@ CREATE TABLE IF NOT EXISTS application_services(
|
|||||||
url TEXT,
|
url TEXT,
|
||||||
token TEXT,
|
token TEXT,
|
||||||
hs_token TEXT,
|
hs_token TEXT,
|
||||||
|
sender TEXT,
|
||||||
UNIQUE(token) ON CONFLICT ROLLBACK
|
UNIQUE(token) ON CONFLICT ROLLBACK
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ CREATE TABLE IF NOT EXISTS application_services(
|
|||||||
url TEXT,
|
url TEXT,
|
||||||
token TEXT,
|
token TEXT,
|
||||||
hs_token TEXT,
|
hs_token TEXT,
|
||||||
|
sender TEXT,
|
||||||
UNIQUE(token) ON CONFLICT ROLLBACK
|
UNIQUE(token) ON CONFLICT ROLLBACK
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user