element-hq / element-hq/synapse
Add ability for password auth modules to modify user profile and threepid information
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#7734](https://github.com/matrix-org/synapse/issues/7734).
---
ma1sd is currently [trying to](https://github.com/ma1uta/ma1sd/issues/16) eliminate their need to reach into Synapse's guts and pull out the datastore object to achieve some simple tasks such as modifying user displayname/threepids during login. We've [dissuaded them](https://github.com/matrix-org/synapse/issues/6772#issuecomment-577723490) from doing this without providing an alternative.
This would involve adding the following abilities to [password auth providers](https://github.com/matrix-org/synapse/blob/develop/docs/password_auth_providers.md) in the [ModuleApi](https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py):
* The ability to set/update a user's displayname
* The ability to set (and optionally replace) the user's threepids
**Recommended implementation** is to add a method to `ModuleApi` which, given a fully qualified user ID (`@alice:example.com`), allows you to set profile information such as displayname and threepids.
ma1sd also includes functionality of **replacing the user's existing threepids**. This could be achieved by either adding an option to the above-mentioned method, which would replace whatever the user's current threepids are, *or* adding two more methods: one to get user threepids, and another to delete them individually. I'm willing to discuss which may be more useful generally.
It should be noted that [ModuleApi.register_user](https://github.com/matrix-org/synapse/blob/3e6b5bba7177274db5533cc5aae0a0f8acf71597/synapse/module_api/__init__.py#L116) method allows for setting displyname on register (but what if we want to do it on login?) and allows you to set *emails* for the user, but not phone numbers.
Implementations must remain backwards compatible.
Contributor guide
Research direction
Start with docs/password_auth_providers.md and synapse/module_api/__init__.py, especially ModuleApi.register_user. Review how password auth providers access the ModuleApi and determine the backwards-compatible interface for updating displaynames and setting or replacing threepids. Done means the provider API supports these operations without requiring direct datastore access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authentication, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100