1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adminer_ynh.git synced 2024-09-03 18:06:06 +02:00

[Add] App visible to a unique user.

This commit is contained in:
Fol de Dol 2014-07-22 16:08:09 +02:00
parent 57667bad72
commit 293983e33a
5 changed files with 29 additions and 3 deletions

View file

@ -3,7 +3,6 @@ location YNH_WWW_PATH {
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
client_max_body_size 10G;
index index.php;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
@ -14,4 +13,7 @@ location YNH_WWW_PATH {
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -29,6 +29,14 @@
},
"example": "/adminer",
"default": "/adminer"
},
{
"name": "admin",
"ask": {
"en": "Choose the only allowed admin user",
"fr": "Choisissez l'unique utilisateur autorisé"
},
"example": "johndoe"
}
]
}

12
scripts/install Executable file → Normal file
View file

@ -3,6 +3,7 @@
# Retrieve arguments
domain=$1
path=$2
admin=$3
app_name="adminer"
@ -12,11 +13,22 @@ if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Check that admin user is an existing account
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
if [[ ! $? -eq 0 ]]; then
echo "Error : the chosen admin user does not exist"
exit 1
fi
# Copy files to the right place
final_path=/var/www/$app_name
sudo mkdir -p $final_path
sudo cp -r ../sources/* $final_path
# Configuration
sudo yunohost add addaccess adminer -u $admin
sudo yunohost add setting adminer admin -v $admin
# Files owned by root, www-data can just read
sudo find $final_path -type f | xargs sudo chmod 644
sudo find $final_path -type d | xargs sudo chmod 755

0
scripts/remove Executable file → Normal file
View file

View file

@ -23,6 +23,10 @@ sudo find $final_path -type f | xargs sudo chmod 644
sudo find $final_path -type d | xargs sudo chmod 755
sudo chown -R root: $final_path
# Configuration
sudo yunohost app addaccess phpmyadmin -u $admin
sudo yunohost app setting phpmyadmin admin -v $admin
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf