mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 16:34:47 -04:00
Add ability to un-shadow-ban via the admin API. (#11347)
This commit is contained in:
parent
0dda1a7968
commit
24b61f379a
5 changed files with 53 additions and 12 deletions
|
@ -909,7 +909,7 @@ class UserTokenRestServlet(RestServlet):
|
|||
|
||||
|
||||
class ShadowBanRestServlet(RestServlet):
|
||||
"""An admin API for shadow-banning a user.
|
||||
"""An admin API for controlling whether a user is shadow-banned.
|
||||
|
||||
A shadow-banned users receives successful responses to their client-server
|
||||
API requests, but the events are not propagated into rooms.
|
||||
|
@ -917,11 +917,19 @@ class ShadowBanRestServlet(RestServlet):
|
|||
Shadow-banning a user should be used as a tool of last resort and may lead
|
||||
to confusing or broken behaviour for the client.
|
||||
|
||||
Example:
|
||||
Example of shadow-banning a user:
|
||||
|
||||
POST /_synapse/admin/v1/users/@test:example.com/shadow_ban
|
||||
{}
|
||||
|
||||
200 OK
|
||||
{}
|
||||
|
||||
Example of removing a user from being shadow-banned:
|
||||
|
||||
DELETE /_synapse/admin/v1/users/@test:example.com/shadow_ban
|
||||
{}
|
||||
|
||||
200 OK
|
||||
{}
|
||||
"""
|
||||
|
@ -945,6 +953,18 @@ class ShadowBanRestServlet(RestServlet):
|
|||
|
||||
return 200, {}
|
||||
|
||||
async def on_DELETE(
|
||||
self, request: SynapseRequest, user_id: str
|
||||
) -> Tuple[int, JsonDict]:
|
||||
await assert_requester_is_admin(self.auth, request)
|
||||
|
||||
if not self.hs.is_mine_id(user_id):
|
||||
raise SynapseError(400, "Only local users can be shadow-banned")
|
||||
|
||||
await self.store.set_shadow_banned(UserID.from_string(user_id), False)
|
||||
|
||||
return 200, {}
|
||||
|
||||
|
||||
class RateLimitRestServlet(RestServlet):
|
||||
"""An admin API to override ratelimiting for an user.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue