2023-09-04 16:06:35 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source /etc/yunohost/apps/chatonsinfos/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
app=$1
|
2023-11-29 21:33:54 +01:00
|
|
|
|
|
|
|
[ "${app}" == "chatonsinfos" ] && exit 0
|
|
|
|
|
2023-09-04 16:06:35 +02:00
|
|
|
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
|