From 4c98e71475ca20a33205d3111a8f3547bd3095e5 Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 14 Jun 2023 01:29:29 +0200 Subject: [PATCH] Some documentations (README files). --- README.delete-user | 80 +++++++++++++++++++++++++++++++++++++++++++++- README.mmctl | 44 +++++++++++++++++++++++++ README.upgrade | 4 +++ 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 README.mmctl diff --git a/README.delete-user b/README.delete-user index f47f5ee..8347a6b 100644 --- a/README.delete-user +++ b/README.delete-user @@ -17,10 +17,88 @@ # Permanently delete a user and all related information, including posts from the database. # -# mattermost user delete +# Requirement: +# Set "EnableAPIUserDeletion" to "true" in file /opt/mattermost/config/config.json and restart mattermost +# +# /opt/mattermost/bin/mmctl user delete # # Note: # Does not delete content from the file storage. You can manually delete all file uploads # for a given user as uploads contain the CreatorId field. User profile pictures are stored # in data/users//profile.png. + +# Set "EnableAPIUserDeletion" to "true" in file /opt/mattermost/config/config.json +# +perl -i -n -p -e "s/^(\s*\"EnableAPIUserDeletion\":).*$/\1 true,/" /opt/mattermost/config/config.json + +# Restart Mattermost +# +systemctl restart mattermost + +usr_to_delete=" + a.marinou-strohm + angelika + bennie + clarissa + david + fabian + georg + hanna + hannahnieswand + leonie + leoniestetter + lilian + lisa + lsachenbacher + ludwig + klaudia + mads + owain + stina + tim_vallee + viktar +" + +clear +echo "" +for _user in $usr_to_delete ; do + echo "" + echo $_user + if $(mmctl user list 2> /dev/null | grep -q $_user) ; then + echo -n " Delete user '$_user' [yes/no]: " + read OK + OK="${OK,,}" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echo -n " Wrong answer - repeat [yes/no]: " + read OK + OK="${OK,,}" + done + + if [[ $OK = "yes" ]] ; then + + # Delete user + # + /opt/mattermost/bin/mmctl user delete $_user --confirm > /dev/null 2>&1 + + if [[ $? -ne 0 ]]; then + echo -e " [ \033[31m\033[1mError\033[m ] Deleting user '$_user' failed!" + else + echo -e " [ \033[32m\033[1mInfo\033[m ] User '$_user' was deleted." + fi + else + echo -e " [ \033[33m\033[1mWarning\033[m ] User '$_user' was omitted" + fi + else + echo -e " [ \033[31m\033[1mError\033[m ] User '$_user' not found!" + fi +done + +# 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 + +# Restart Mattermost +# +systemctl restart mattermost + diff --git a/README.mmctl b/README.mmctl new file mode 100644 index 0000000..43e24f1 --- /dev/null +++ b/README.mmctl @@ -0,0 +1,44 @@ +# --- +# Mattermost Administration - mmctl command line tool +# --- + + +# see: https://docs.mattermost.com/manage/mmctl-command-line-tool.html + + + +# Manage the credentials and authentication methods of remote Mattermost instances. +# +# Format +# +# mmctl auth login --name > --username --password-file +# mmctl auth login --name > --username +# mmctl auth login +# +# Examples +# +# /opt/mattermost/bin/mmctl auth login --name local-server https://mm-irights.oopen.de --username admin-irights +# +# +# this stores the credentials at ~/.config/mmctl/config +# +# This is done by command "mmctl auth login" +# +# Example (for site mm-irights.oopen.de) +# +# name: local-server +# username: admin-irights +# password: M6aHdhGh_I%9 +# instanceUrl: https://mm-irights.oopen.de +# +/opt/mattermost/bin/mmctl auth login --name local-server https://mm-irights.oopen.de --username admin-irights + + +# List your defined credentials at ~/.config/mmctl/config +# +/opt/mattermost/bin/mmctl auth list + + +# Set credentilas named 'local-server' as active +# +/opt/mattermost/bin/mmctl auth set local-server diff --git a/README.upgrade b/README.upgrade index b18dd26..21d6c7d 100644 --- a/README.upgrade +++ b/README.upgrade @@ -2,6 +2,10 @@ # Aktualisieren des Mattermost-Servers # ------------------------------------ +# How do I install the Extended Support Release (ESR)? +# +# see: https://docs.mattermost.com/upgrade/extended-support-release.html + # # see: # - https://docs.mattermost.com/guides/administrator.html#upgrade-mattermost