|
@@ -334,7 +334,23 @@ function remove_user_matrix {
|
334
|
334
|
|
335
|
335
|
${PROJECT_NAME}-pass -u $remove_username --rmapp matrix
|
336
|
336
|
|
337
|
|
- # TODO: There is no user removal script within synapse
|
|
337
|
+ read_config_param MY_USERNAME
|
|
338
|
+ read_config_param MATRIX_DOMAIN_NAME
|
|
339
|
+
|
|
340
|
+ matrix_remove_user=/usr/bin/matrix-remove-user
|
|
341
|
+ echo '#!/bin/bash' > $matrix_remove_user
|
|
342
|
+ echo "cd $MATRIX_DATA_DIR" >> $matrix_remove_user
|
|
343
|
+ echo 'remove_username=$1' >> $matrix_remove_user
|
|
344
|
+ echo "ADMIN=\"@${MY_USERNAME}:$MATRIX_DOMAIN_NAME\"" >> $matrix_remove_user
|
|
345
|
+ echo 'BUSY="pragma busy_timeout=20000"' >> $matrix_remove_user
|
|
346
|
+ echo "BUFFER=\$(sqlite3 homeserver.db \"\$BUSY;select token from access_tokens where user_id like '\$ADMIN' order by id desc limit 1;\")" >> $matrix_remove_user
|
|
347
|
+ echo "TOKEN=\$(echo \$BUFFER|awk '{print \$2}')" >> $matrix_remove_user
|
|
348
|
+ echo 'set -x' >> $matrix_remove_user
|
|
349
|
+ echo "curl -X POST 'https://$MATRIX_DOMAIN_NAME/_matrix/client/r0/admin/deactivate/%40\$remove_username%3A$MATRIX_DOMAIN_NAME?access_token=\$TOKEN' --data '{}'" >> $matrix_remove_user
|
|
350
|
+
|
|
351
|
+ chmod +x $matrix_remove_user
|
|
352
|
+
|
|
353
|
+ $matrix_remove_user "$remove_username"
|
338
|
354
|
}
|
339
|
355
|
|
340
|
356
|
function add_user_matrix {
|