mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-25 02:55:46 +03:00
Parse the io.element.msc4190 flag on AS registrations
This commit is contained in:
parent
ebad618bf0
commit
eb6636380f
2 changed files with 15 additions and 0 deletions
|
@ -87,6 +87,7 @@ class ApplicationService:
|
||||||
ip_range_whitelist: Optional[IPSet] = None,
|
ip_range_whitelist: Optional[IPSet] = None,
|
||||||
supports_ephemeral: bool = False,
|
supports_ephemeral: bool = False,
|
||||||
msc3202_transaction_extensions: bool = False,
|
msc3202_transaction_extensions: bool = False,
|
||||||
|
msc4190_device_management: bool = False,
|
||||||
):
|
):
|
||||||
self.token = token
|
self.token = token
|
||||||
self.url = (
|
self.url = (
|
||||||
|
@ -100,6 +101,7 @@ class ApplicationService:
|
||||||
self.ip_range_whitelist = ip_range_whitelist
|
self.ip_range_whitelist = ip_range_whitelist
|
||||||
self.supports_ephemeral = supports_ephemeral
|
self.supports_ephemeral = supports_ephemeral
|
||||||
self.msc3202_transaction_extensions = msc3202_transaction_extensions
|
self.msc3202_transaction_extensions = msc3202_transaction_extensions
|
||||||
|
self.msc4190_device_management = msc4190_device_management
|
||||||
|
|
||||||
if "|" in self.id:
|
if "|" in self.id:
|
||||||
raise Exception("application service ID cannot contain '|' character")
|
raise Exception("application service ID cannot contain '|' character")
|
||||||
|
|
|
@ -183,6 +183,18 @@ def _load_appservice(
|
||||||
"The `org.matrix.msc3202` option should be true or false if specified."
|
"The `org.matrix.msc3202` option should be true or false if specified."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Opt-in flag for the MSC4190 behaviours.
|
||||||
|
# When enabled, the following C-S API endpoints change:
|
||||||
|
# - POST /register does not return an access token
|
||||||
|
# - PUT /devices/{device_id} creates a new device if one does not exist
|
||||||
|
# - DELETE /devices/{device_id} no longer requires UIA
|
||||||
|
# - POST /delete_devices/{device_id} no longer requires UIA
|
||||||
|
msc4190_enabled = as_info.get("io.element.msc4190", False)
|
||||||
|
if not isinstance(msc4190_enabled, bool):
|
||||||
|
raise ValueError(
|
||||||
|
"The `io.element.msc4190` option should be true or false if specified."
|
||||||
|
)
|
||||||
|
|
||||||
return ApplicationService(
|
return ApplicationService(
|
||||||
token=as_info["as_token"],
|
token=as_info["as_token"],
|
||||||
url=as_info["url"],
|
url=as_info["url"],
|
||||||
|
@ -195,4 +207,5 @@ def _load_appservice(
|
||||||
ip_range_whitelist=ip_range_whitelist,
|
ip_range_whitelist=ip_range_whitelist,
|
||||||
supports_ephemeral=supports_ephemeral,
|
supports_ephemeral=supports_ephemeral,
|
||||||
msc3202_transaction_extensions=msc3202_transaction_extensions,
|
msc3202_transaction_extensions=msc3202_transaction_extensions,
|
||||||
|
msc4190_device_management=msc4190_enabled,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue