Created
July 24, 2018 10:17
-
-
Save rgpublic/8457d98b0fcc0c54893b9907f9b8b825 to your computer and use it in GitHub Desktop.
Synapse deactive user
This file contains 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
#!/bin/bash | |
echo -e "\e[97mPlease enter password for Synapse/Matrix root user:\e[0m"; | |
read -s password | |
echo -e "\e[97mEnter user you'd like to deactivate\e[0m"; | |
read user | |
url_user=`echo -n "$user" | jq -s -R -r @uri` | |
json=`curl -s --insecure -XPOST -d '{"type":"m.login.password", "user":"root", "password":"'$password'"}' "https://localhost:8448/_matrix/client/r0/login"` | |
access_token=`echo "$json" | jq -r ".access_token"` | |
curl --insecure -XPOST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d \ | |
'{}' "https://localhost:8448/_matrix/client/r0/admin/deactivate/$url_user" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rgpublic
it doesn't look like you're script works anymore as it looks like the API endpoint has changed
from
https://localhost:8448/_matrix/client/r0/admin/deactivate/$url_user
to
https://localhost:8448/_synapse/admin/v1/deactivate/$url_user
other than that the script works well and it's very helpful