You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/modules/third_party_rules_callbacks.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,49 @@ deny an incoming event, see [`check_event_for_spam`](spam_checker_callbacks.md#c
148
148
149
149
If multiple modules implement this callback, Synapse runs them allin order.
150
150
151
+
### `check_can_shutdown_room`
152
+
153
+
_First introduced in Synapse v1.55.0_
154
+
155
+
```python
156
+
asyncdef check_can_shutdown_room(
157
+
user_id: str, room_id: str,
158
+
) ->bool:
159
+
```
160
+
161
+
Called when an admin user requests the shutdown of a room. The module must return a
162
+
boolean indicating whether the shutdown can go through. If the callback returns `False`,
163
+
the shutdown will not proceed and the caller will see a `M_FORBIDDEN` error.
164
+
165
+
If multiple modules implement this callback, they will be considered in order. If a
166
+
callback returns `True`, Synapse falls through to the next one. The value of the first
167
+
callback that does notreturn`True` will be used. If this happens, Synapse will not call
168
+
any of the subsequent implementations of this callback.
169
+
170
+
### `check_can_deactivate_user`
171
+
172
+
_First introduced in Synapse v1.55.0_
173
+
174
+
```python
175
+
asyncdef check_can_deactivate_user(
176
+
user_id: str, by_admin: bool,
177
+
) ->bool:
178
+
```
179
+
180
+
Called when the deactivation of a user is requested. User deactivation can be
181
+
performed by an admin or the user themselves, so developers are encouraged to check the
182
+
requester when implementing this callback. The module must return a
183
+
boolean indicating whether the deactivation can go through. If the callback returns `False`,
184
+
the deactivation will not proceed and the caller will see a `M_FORBIDDEN` error.
185
+
186
+
The module is passed two parameters, `user_id` which is the ID of the user being deactivated, and`by_admin` which is`True`if the request is made by a serve admin, and`False` otherwise.
187
+
188
+
If multiple modules implement this callback, they will be considered in order. If a
189
+
callback returns `True`, Synapse falls through to the next one. The value of the first
190
+
callback that does notreturn`True` will be used. If this happens, Synapse will not call
191
+
any of the subsequent implementations of this callback.
0 commit comments