README.delete-user: Log in to an instance and store credentials bevor you are able to list/delete/.. user.

This commit is contained in:
Christoph 2023-12-02 01:18:08 +01:00
parent 52917ecaf4
commit 90d66b870e

View File

@ -61,10 +61,27 @@ usr_to_delete="
" "
clear clear
# Log in to an instance and store credentials.
#
# instance url: https://mm-irights.oopen.de
# server name: local-server
# username: admin-irights
# password: M6aHdhGh_I%9
# save password to a file
#
cat << EOF > .mm-admin-irights.auth
M6aHdhGh_I%9
EOF
mmctl auth login https://mm-irights.oopen.de --name local-server --username admin-irights --password-file .mm-admin-irights.auth
echo "" echo ""
for _user in $usr_to_delete ; do for _user in $usr_to_delete ; do
echo "" echo ""
echo $_user echo $_user
if $(mmctl user list 2> /dev/null | grep -q $_user) ; then if $(mmctl user list 2> /dev/null | grep -q $_user) ; then
echo -n " Delete user '$_user' [yes/no]: " echo -n " Delete user '$_user' [yes/no]: "
read OK read OK
@ -94,6 +111,9 @@ for _user in $usr_to_delete ; do
fi fi
done done
rm .mm-admin-irights.auth
# Set "EnableAPIUserDeletion" to "false" in file /opt/mattermost/config/config.json # Set "EnableAPIUserDeletion" to "false" in file /opt/mattermost/config/config.json
# #
perl -i -n -p -e "s/^(\s*\"EnableAPIUserDeletion\":).*$/\1 false,/" /opt/mattermost/config/config.json perl -i -n -p -e "s/^(\s*\"EnableAPIUserDeletion\":).*$/\1 false,/" /opt/mattermost/config/config.json