mirror of
https://github.com/YunoHost-Apps/ampache_ynh.git
synced 2024-09-03 18:15:55 +02:00
add admin
This commit is contained in:
parent
ff6ae1b4e1
commit
52c493689c
3 changed files with 22 additions and 3 deletions
|
@ -287,7 +287,7 @@ use_auth = "true"
|
||||||
; if use_auth if false
|
; if use_auth if false
|
||||||
; POSSIBLE VALUES: user, admin, manager, guest
|
; POSSIBLE VALUES: user, admin, manager, guest
|
||||||
; DEFAULT: admin
|
; DEFAULT: admin
|
||||||
default_auth_level = "admin"
|
default_auth_level = "user"
|
||||||
|
|
||||||
; 5 Star Ratings
|
; 5 Star Ratings
|
||||||
; This allows ratings for almost any object in ampache
|
; This allows ratings for almost any object in ampache
|
||||||
|
@ -554,7 +554,7 @@ ldap_search_dn = "dc=yunohost,dc=org"
|
||||||
|
|
||||||
; This is the address of your ldap server (required)
|
; This is the address of your ldap server (required)
|
||||||
; DEFAULT: null
|
; DEFAULT: null
|
||||||
ldap_url = "192.168.1.88"
|
ldap_url = "localhost"
|
||||||
|
|
||||||
; Attributes where additional user information is stored (optional)
|
; Attributes where additional user information is stored (optional)
|
||||||
; OpenLDAP ldap_name_field = "cn"
|
; OpenLDAP ldap_name_field = "cn"
|
||||||
|
@ -613,7 +613,7 @@ auto_create = "true"
|
||||||
; added as a guest and must be promoted by the admin.
|
; added as a guest and must be promoted by the admin.
|
||||||
; POSSIBLE VALUES: guest, user, admin
|
; POSSIBLE VALUES: guest, user, admin
|
||||||
; DEFAULT: guest
|
; DEFAULT: guest
|
||||||
auto_user = "admin"
|
auto_user = "yunoadmin"
|
||||||
|
|
||||||
; This will display the user agreement when registering
|
; This will display the user agreement when registering
|
||||||
; For agreement text, edit templates/user_agreement.php
|
; For agreement text, edit templates/user_agreement.php
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
},
|
},
|
||||||
"example": "/ampache",
|
"example": "/ampache",
|
||||||
"default": "/ampache"
|
"default": "/ampache"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose the Ampache administrator (must be an existing YunoHost user)",
|
||||||
|
"fr": "Administrateur du serveur Ampache (doit être un utilisateur Yunohost existant)"
|
||||||
|
},
|
||||||
|
"example": "homer"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
admin_ampache=$3
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a ampache
|
sudo yunohost app checkurl $domain$path -a ampache
|
||||||
|
@ -10,6 +11,15 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if admin exists
|
||||||
|
sudo yunohost user list --json | grep -q "\"username\": \"$admin_ampache\""
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
echo "Wrong admin"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo yunohost app setting ampache admin -v $admin_ampache
|
||||||
|
|
||||||
# Generate random password
|
# Generate random password
|
||||||
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
|
|
||||||
|
@ -30,6 +40,7 @@ sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||||
sudo sed -i "s/yunouser/$db_user/g" $final_path/config/ampache.cfg.php
|
sudo sed -i "s/yunouser/$db_user/g" $final_path/config/ampache.cfg.php
|
||||||
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php
|
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php
|
||||||
sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php
|
sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php
|
||||||
|
sudo sed -i "s/yunoadmin/$admin_ampache/g" $final_path/config/ampache.cfg.php
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php
|
sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php
|
||||||
sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
|
sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue