Created
March 27, 2022 13:22
-
-
Save mguentner/12c36bfe01260cfd32a73542aa152424 to your computer and use it in GitHub Desktop.
(mass) delete users on a synapse instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
USERS=("@some_user:your-server.tld", "@some_other_user:your-server.tld") | |
set -x | |
ADMIN_USER="your-admin-user" | |
PASSWORD="your-admin-password" | |
SERVER="your-server.tld" | |
TOKEN=$(curl -XPOST -d "{\"type\":\"m.login.password\", \"user\":\"$ADMIN_USER\", \"password\":\"$PASSWORD\"}" "https://$SERVER/_matrix/client/r0/login" | jq .access_token | sed s/\"//g ) | |
for USER in ${USERS[@]} | |
do | |
curl -POST -H "Authorization: Bearer $TOKEN" -d '{"erase": true }' "https://$SERVER/_synapse/admin/v1/deactivate/$USER" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment