Allow toggle to enable/disable merging 3PIDs in profile
This commit is contained in:
@@ -75,6 +75,14 @@ If you would like to change the behaviour, you can use the following configurati
|
|||||||
```
|
```
|
||||||
|
|
||||||
3PIDs received from the backend are merged with the ones already linked to the account.
|
3PIDs received from the backend are merged with the ones already linked to the account.
|
||||||
|
If you would like to change this behaviour, you can use the following configuration item:
|
||||||
|
```yaml
|
||||||
|
config:
|
||||||
|
policy:
|
||||||
|
all:
|
||||||
|
threepid:
|
||||||
|
update: false
|
||||||
|
```
|
||||||
|
|
||||||
## Integrate
|
## Integrate
|
||||||
To use this module with your back-end, you will need to implement a single REST endpoint:
|
To use this module with your back-end, you will need to implement a single REST endpoint:
|
||||||
|
@@ -87,6 +87,7 @@ class RestAuthProvider(object):
|
|||||||
else:
|
else:
|
||||||
logger.info("Display name was not set because it was not given or policy restricted it")
|
logger.info("Display name was not set because it was not given or policy restricted it")
|
||||||
|
|
||||||
|
if (self.config.updateThreepid):
|
||||||
if "three_pids" in profile:
|
if "three_pids" in profile:
|
||||||
logger.info("Handling 3PIDs")
|
logger.info("Handling 3PIDs")
|
||||||
for threepid in profile["three_pids"]:
|
for threepid in profile["three_pids"]:
|
||||||
@@ -106,6 +107,8 @@ class RestAuthProvider(object):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.info("3PID is present, skipping")
|
logger.info("3PID is present, skipping")
|
||||||
|
else:
|
||||||
|
logger.info("3PIDs were not updated due to policy")
|
||||||
else:
|
else:
|
||||||
logger.info("No profile data")
|
logger.info("No profile data")
|
||||||
|
|
||||||
@@ -121,6 +124,7 @@ class RestAuthProvider(object):
|
|||||||
regLower = True
|
regLower = True
|
||||||
setNameOnRegister = True
|
setNameOnRegister = True
|
||||||
setNameOnLogin = False
|
setNameOnLogin = False
|
||||||
|
updateThreepid = True
|
||||||
|
|
||||||
rest_config = _RestConfig()
|
rest_config = _RestConfig()
|
||||||
rest_config.endpoint = config["endpoint"]
|
rest_config.endpoint = config["endpoint"]
|
||||||
@@ -152,6 +156,15 @@ class RestAuthProvider(object):
|
|||||||
# we don't care
|
# we don't care
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
rest_config.updateThreepid = config['policy']['all']['threepid']['update']
|
||||||
|
except TypeError:
|
||||||
|
# we don't care
|
||||||
|
pass
|
||||||
|
except KeyError:
|
||||||
|
# we don't care
|
||||||
|
pass
|
||||||
|
|
||||||
return rest_config
|
return rest_config
|
||||||
|
|
||||||
def _require_keys(config, required):
|
def _require_keys(config, required):
|
||||||
|
Reference in New Issue
Block a user