diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2021-09-08 19:14:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 17:14:54 +0000 |
commit | 03caba65777ab6ec8d089f8975352242e0d7b0af (patch) | |
tree | a88495bb8c0f11d55c56ab3c5075673a69e9cf48 /docs/modules/account_validity_callbacks.md | |
parent | Fix frontend_proxy jinja script in docker workers (#10783) (diff) | |
download | synapse-03caba65777ab6ec8d089f8975352242e0d7b0af.tar.xz |
Improve the modules doc (#10758)
* Split up the documentation in several files rather than one huge one * Add examples for each callback category * Other niceties like fixing https://github.com/matrix-org/synapse/issues/10632 * Add titles to callbacks so they're easier to find in the navigation panels and link to
Diffstat (limited to 'docs/modules/account_validity_callbacks.md')
-rw-r--r-- | docs/modules/account_validity_callbacks.md | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/modules/account_validity_callbacks.md b/docs/modules/account_validity_callbacks.md new file mode 100644 index 0000000000..80684b7828 --- /dev/null +++ b/docs/modules/account_validity_callbacks.md @@ -0,0 +1,33 @@ +# Account validity callbacks + +Account validity callbacks allow module developers to add extra steps to verify the +validity on an account, i.e. see if a user can be granted access to their account on the +Synapse instance. Account validity callbacks can be registered using the module API's +`register_account_validity_callbacks` method. + +The available account validity callbacks are: + +### `is_user_expired` + +```python +async def is_user_expired(user: str) -> Optional[bool] +``` + +Called when processing any authenticated request (except for logout requests). The module +can return a `bool` to indicate whether the user has expired and should be locked out of +their account, or `None` if the module wasn't able to figure it out. The user is +represented by their Matrix user ID (e.g. `@alice:example.com`). + +If the module returns `True`, the current request will be denied with the error code +`ORG_MATRIX_EXPIRED_ACCOUNT` and the HTTP status code 403. Note that this doesn't +invalidate the user's access token. + +### `on_user_registration` + +```python +async def on_user_registration(user: str) -> None +``` + +Called after successfully registering a user, in case the module needs to perform extra +operations to keep track of them. (e.g. add them to a database table). The user is +represented by their Matrix user ID. |