mirror of
https://github.com/YunoHost-Apps/chatonsinfos_ynh.git
synced 2024-09-03 18:15:58 +02:00
[enh] Restore and access update
This commit is contained in:
parent
59d6573f45
commit
b5d4e6dfc7
3 changed files with 59 additions and 0 deletions
29
hooks/post_app_addaccess
Normal file
29
hooks/post_app_addaccess
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source /etc/yunohost/apps/chatonsinfos/scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
app=$1
|
||||||
|
install_dir=/var/www/chatonsinfos/
|
||||||
|
service_path=${install_dir}public/${app}.properties
|
||||||
|
local groups_added=$4
|
||||||
|
local app_info="$(yunohost app info $app --full --json)"
|
||||||
|
get_info() {
|
||||||
|
echo $app_info | jq -r ".$1"
|
||||||
|
}
|
||||||
|
if [[ "$groups_added" == *"visitors"* ]]
|
||||||
|
then
|
||||||
|
registration=$(ynh_read_var_in_file --file="$service_path" --key="service.registration")
|
||||||
|
local ldap="$(get_info 'manifest.integration.ldap')"
|
||||||
|
local sso="$(get_info 'manifest.integration.sso')"
|
||||||
|
if [[ "$registration" != "None" && "$registration" != "Free" ]]
|
||||||
|
then
|
||||||
|
if [[ "$ldap" == "not_relevant" && "$sso" == "not_relevant" ]]
|
||||||
|
then
|
||||||
|
registration="None"
|
||||||
|
elif [[ "$ldap" == "false" ]]
|
||||||
|
then
|
||||||
|
registration="Free"
|
||||||
|
fi
|
||||||
|
ynh_write_var_in_file --file="$service_path" --key="service.registration" --value="$registration"
|
||||||
|
fi
|
||||||
|
fi
|
22
hooks/post_app_removeaccess
Normal file
22
hooks/post_app_removeaccess
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source /etc/yunohost/apps/chatonsinfos/scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
app=$1
|
||||||
|
install_dir=/var/www/chatonsinfos/
|
||||||
|
service_path=${install_dir}public/${app}.properties
|
||||||
|
local groups_removed=$4
|
||||||
|
local app_info="$(yunohost app info $app --full --json)"
|
||||||
|
get_info() {
|
||||||
|
echo $app_info | jq -r ".$1"
|
||||||
|
}
|
||||||
|
if [[ "$groups_removed" == *"visitors"* ]]
|
||||||
|
then
|
||||||
|
registration=$(ynh_read_var_in_file --file="$service_path" --key="service.registration")
|
||||||
|
local ldap="$(get_info 'manifest.integration.ldap')"
|
||||||
|
local sso="$(get_info 'manifest.integration.sso')"
|
||||||
|
if [[ "$registration" != "Member" && "$registration" != "Client" ]]
|
||||||
|
then
|
||||||
|
ynh_write_var_in_file --file="$service_path" --key="service.registration" --value="Member"
|
||||||
|
fi
|
||||||
|
fi
|
8
hooks/post_app_restore
Normal file
8
hooks/post_app_restore
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source /etc/yunohost/apps/chatonsinfos/scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
install_dir=/var/www/chatonsinfos/
|
||||||
|
generate_config_panel
|
||||||
|
update_subs
|
Loading…
Reference in a new issue