mirror of
https://github.com/YunoHost-Apps/opensondage_ynh.git
synced 2024-09-03 19:46:28 +02:00
Add permission control on poll creation.
This commit is contained in:
parent
3bfd16e50b
commit
a97f3058ab
5 changed files with 32 additions and 46 deletions
|
@ -9,13 +9,12 @@ location PATHTOCHANGE {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-opensondage.sock;
|
fastcgi_pass unix:/var/run/php5-fpm-opensondage.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
}
|
}
|
||||||
|
# Include SSOWAT user panel.
|
||||||
# Include SSOWAT user panel.
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^PATHTOCHANGE/(data|config|\.ht|db_structure\.xml|README) {
|
location ~ ^PATHTOCHANGE/(data|config|\.ht|db_structure\.xml|README) {
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
location PATHTOCHANGE {
|
|
||||||
alias ALIASTOCHANGE;
|
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
index index.php;
|
|
||||||
try_files $uri $uri/ /index.php;
|
|
||||||
location ~ [^/]\.php(/|$) {
|
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-opensondage.sock;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
||||||
fastcgi_param HTTPS on;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ ^PATHTOCHANGE/admin {
|
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
index index.php;
|
|
||||||
try_files $uri $uri/ /index.php;
|
|
||||||
location ~ [^/]\.php(/|$) {
|
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-opensondage.sock;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
||||||
fastcgi_param HTTPS on;
|
|
||||||
}
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ ^PATHTOCHANGE/(data|config|\.ht|db_structure\.xml|README) {
|
|
||||||
deny all;
|
|
||||||
}
|
|
|
@ -56,6 +56,15 @@
|
||||||
},
|
},
|
||||||
"choices": ["en_GB", "fr_FR","es_ES", "de_DE"],
|
"choices": ["en_GB", "fr_FR","es_ES", "de_DE"],
|
||||||
"default": "en_GB"
|
"default": "en_GB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "public_site",
|
||||||
|
"ask": {
|
||||||
|
"en": "Could non member create poll ?",
|
||||||
|
"fr": "Une personne non membre peut elle créer un sondage ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "Yes"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ path=$2
|
||||||
admin=$3
|
admin=$3
|
||||||
legal=$4
|
legal=$4
|
||||||
language=$5
|
language=$5
|
||||||
|
public_site=$6
|
||||||
|
|
||||||
# Check if admin exists
|
# Check if admin exists
|
||||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
||||||
|
@ -16,6 +17,7 @@ fi
|
||||||
sudo yunohost app setting opensondage admin -v $admin
|
sudo yunohost app setting opensondage admin -v $admin
|
||||||
sudo yunohost app setting opensondage language -v $language
|
sudo yunohost app setting opensondage language -v $language
|
||||||
sudo yunohost app setting opensondage legal -v $legal
|
sudo yunohost app setting opensondage legal -v $legal
|
||||||
|
sudo yunohost app setting opensondage public_site -v $public_site
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a opensondage
|
sudo yunohost app checkurl $domain$path -a opensondage
|
||||||
|
@ -64,7 +66,12 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/opensondage.conf
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app setting opensondage skipped_uris -v "/"
|
sudo yunohost app setting opensondage skipped_uris -v "/"
|
||||||
sudo yunohost app setting opensondage protected_uris -v "/admin"
|
if [ $public_site = "No" ];
|
||||||
|
then
|
||||||
|
sudo yunohost app setting opensondage protected_uris -v "/admin,/index.php,/choix_sondage.php,/info_sondage.php"
|
||||||
|
else
|
||||||
|
sudo yunohost app setting opensondage protected_uris -v "/admin"
|
||||||
|
fi
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
# Db installation
|
# Db installation
|
||||||
|
|
|
@ -6,6 +6,7 @@ path=$(sudo yunohost app setting opensondage path)
|
||||||
admin=$(sudo yunohost app setting opensondage admin)
|
admin=$(sudo yunohost app setting opensondage admin)
|
||||||
legal=$(sudo yunohost app setting opensondage legal)
|
legal=$(sudo yunohost app setting opensondage legal)
|
||||||
language=$(sudo yunohost app setting opensondage language)
|
language=$(sudo yunohost app setting opensondage language)
|
||||||
|
public_site=$(sudo yunohost app setting opensondage public_site)
|
||||||
|
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ sudo sed -i "s/yunoadmin/$admin/g" $final_path/variables.php
|
||||||
sudo sed -i "s/I18NTOCHANGE/$language/g" $final_path/variables.php
|
sudo sed -i "s/I18NTOCHANGE/$language/g" $final_path/variables.php
|
||||||
sudo sed -i "s@yunourl@$domain$path@g" $final_path/variables.php
|
sudo sed -i "s@yunourl@$domain$path@g" $final_path/variables.php
|
||||||
sudo sed -i "s@yunodomain@$domain@g" $final_path/variables.php
|
sudo sed -i "s@yunodomain@$domain@g" $final_path/variables.php
|
||||||
sudo sed -i "s°yunoinfolegal°$legal°g" $final_path/variables.php
|
sudo sed -i "s@yunoinfolegal@$legal@g" $final_path/variables.php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,3 +90,11 @@ sudo chmod 644 $finalphpini
|
||||||
sudo service php5-fpm restart
|
sudo service php5-fpm restart
|
||||||
# Reload Nginx
|
# Reload Nginx
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
sudo yunohost app setting opensondage skipped_uris -v "/"
|
||||||
|
if [ $public_site = "No" ];
|
||||||
|
then
|
||||||
|
sudo yunohost app setting opensondage protected_uris -v "/admin,/index.php,/choix_sondage.php,/info_sondage.php"
|
||||||
|
else
|
||||||
|
sudo yunohost app setting opensondage protected_uris -v "/admin"
|
||||||
|
fi
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
|
Loading…
Add table
Reference in a new issue