1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00
synapse_ynh/sources/set_admin_user.sh

22 lines
517 B
Bash
Raw Permalink Normal View History

2024-02-20 23:49:31 +01:00
#!/bin/bash
set -eu
source /usr/share/yunohost/helpers
app=__APP__
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
if [ -z ${1:-} ]; then
echo "Usage: set_admin_user.sh user_to_set_as_admin"
exit 1
fi
ynh_psql_execute_as_root --database=$db_name --sql="UPDATE users SET admin = 1 WHERE name = '@$1:$server_name'"
exit 0