Adding matrix users

This commit is contained in:
Bob Mottram 2017-08-17 19:01:00 +01:00
parent 0e36a43ae0
commit 8c0afcc08e
1 changed files with 3 additions and 9 deletions

View File

@ -312,22 +312,16 @@ function remove_user_matrix {
function add_user_matrix {
new_username="$1"
new_user_password="$2"
is_admin_user='-a'
read_config_param MY_USERNAME
read_config_param ONION_ONLY
read_config_param MATRIX_DOMAIN_NAME
if [[ "$new_username" != "$MY_USERNAME" ]]; then
is_admin_user=''
fi
${PROJECT_NAME}-pass -u $new_username -a matrix -p "$new_user_password"
if [[ $ONION_ONLY == 'no' ]]; then
register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" $is_admin_user https://${MATRIX_DOMAIN_NAME}
if [[ "$new_username" != "$MY_USERNAME" ]]; then
echo 'no' | register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" http://localhost:${MATRIX_PORT}
else
register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" $is_admin_user http://${MATRIX_DOMAIN_NAME}
echo 'yes' | register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a http://localhost:${MATRIX_PORT}
fi
echo "0"
}