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

Merge pull request #37 from YunoHost-Apps/testing

Testing
This commit is contained in:
tituspijean 2023-04-26 23:52:23 +02:00 committed by GitHub
commit 7f90a62f30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 90 additions and 73 deletions

View file

@ -22,7 +22,7 @@ The idea of [æneria](https://aeneria.com) is to display energy consumption and
* Analyse energy consumption throw weather data
**Shipped version:** 1.1.6~ynh3
**Shipped version:** 1.1.6~ynh4
## Screenshots

View file

@ -22,7 +22,7 @@ The idea of [æneria](https://aeneria.com) is to display energy consumption and
* Analyse energy consumption throw weather data
**Version incluse :** 1.1.6~ynh3
**Version incluse :** 1.1.6~ynh4
## Captures décran

41
hooks/post_app_addaccess Normal file
View file

@ -0,0 +1,41 @@
#!/bin/bash
app=$1
# Run only if we are altering aeneria's permissions
[[ "$app" != "__APP__" ]] && exit 0
# Source YunoHost helpers
source /usr/share/yunohost/helpers
source /etc/yunohost/apps/$app/scripts/_common.sh
# Retrieve arguments
usernames=$2
permission=$3
groups=$4
final_path=$(ynh_app_setting_get "$app" final_path)
phpversion=$(ynh_app_setting_get "$app" phpversion)
IFS=',' read -r -a user_list <<< "$usernames"
IFS=',' read -r -a group_list <<< "$groups"
for group in "${group_list[@]}"
do
group_array=$(yunohost user group list --output-as json --quiet | jq -r --arg group "$group" ".groups.$group.members | @csv" | tr -d \")
IFS=',' read -r -a group_array <<< "$group_array"
user_list+=("${group_array[@]}")
done
pushd $final_path
for user in "${user_list[@]}"
do
mail=$(ynh_user_get_info --username="$user" --key=mail)
user_exists=$(ynh_exec_as $app php$phpversion bin/console aeneria:user:exist "$mail")
if [ $user_exists -eq 0 ]
then
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass" -n
else
ynh_exec_as $app php$phpversion bin/console aeneria:user:activate "$mail"
fi
done
popd

View file

@ -0,0 +1,32 @@
#!/bin/bash
app=$1
# Run only if we are altering aeneria's permissions
[[ "$app" != "__APP__" ]] && exit 0
# Source YunoHost helpers
source /usr/share/yunohost/helpers
source /etc/yunohost/apps/$app/scripts/_common.sh
# Retrieve arguments
usernames=$2
permission=$3
groups=$4
final_path=$(ynh_app_setting_get "$app" final_path)
phpversion=$(ynh_app_setting_get "$app" phpversion)
IFS=',' read -r -a user_list <<< "$usernames"
IFS=',' read -r -a group_list <<< "$groups"
for group in "${group_list[@]}"
do
group_array=$(yunohost user group list --output-as json --quiet | jq -r --arg group "$group" ".groups.$group.members | @csv" | tr -d \")
IFS=',' read -r -a group_array <<< "$group_array"
user_list+=("${group_array[@]}")
done
for user in "${user_list[@]}"
do
mail=$(ynh_user_get_info --username="$user" --key=mail)
cd "$final_path" && ynh_exec_as $app php$phpversion bin/console aeneria:user:deactivate "$mail" -n
done

View file

@ -1,25 +0,0 @@
#!/bin/bash
app=APPNAMETOCHANGE
# Source YunoHost helpers
source /usr/share/yunohost/helpers
source /etc/yunohost/apps/$app/scripts/_common.sh
# Retrieve arguments
username=$1
mail=$2
password=$3 # Clear password
firstname=$4
lastname=$5
final_path=$(ynh_app_setting_get "$app" final_path)
pushd $final_path
user_exists=$(ynh_exec_as $app php7.3 bin/console aeneria:user:exist "$mail")
if [ $user_exists -eq 0 ]
then
user_pass=$(ynh_string_random)
ynh_exec_as $app php7.3 bin/console aeneria:user:add "$mail" "$user_pass" -n
else
ynh_exec_as $app php7.3 bin/console aeneria:user:activate "$mail"
fi
popd

View file

@ -1,17 +0,0 @@
#!/bin/bash
app=APPNAMETOCHANGE
# Source YunoHost helpers
source /usr/share/yunohost/helpers
source /etc/yunohost/apps/$app/scripts/_common.sh
# Retrieve arguments
username=$1
mail=$2
password=$3 # Clear password
firstname=$4
lastname=$5
final_path=$(ynh_app_setting_get "$app" final_path)
# Deactivate the user in aeneria
cd "$final_path" && ynh_exec_as $app php7.3 bin/console aeneria:user:deactivate "$mail" -n

View file

@ -6,7 +6,7 @@
"en": "Dashboard to analyse your energy consumption data from Linky & weather",
"fr": "Tableau de bord pour analyser votre consomation d'énergie à partir des données d'un Linky et de la météo"
},
"version": "1.1.6~ynh3",
"version": "1.1.6~ynh4",
"url": "https://gitlab.com/aeneria/aeneria-app",
"upstream": {
"license": "AGPL-3.0-or-later",

View file

@ -131,16 +131,9 @@ ynh_script_progression --message="Installing aeneria..." --weight=1
pushd $final_path
ynh_exec_as $app php$phpversion bin/console aeneria:install "$app" -n
# Create aeneria's user
for username in $(ynh_user_list)
do
mail=$(ynh_user_get_info --username=$username --key='mail')
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass"
done
# Set admin user
mail=$(ynh_user_get_info --username=$admin --key='mail')
# Create admin user
mail=$(ynh_user_get_info --username="$admin" --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$(ynh_string_random)" -n
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail"
popd
@ -161,8 +154,8 @@ chmod 644 "/etc/cron.d/$app"
#=================================================
ynh_script_progression --message="Adapting hooks..." --weight=1
ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string="$app" --target_file="../hooks/post_user_create"
ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string="$app" --target_file="../hooks/post_user_delete"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess"
#=================================================
# SETUP SSOWAT

View file

@ -166,21 +166,14 @@ pushd $final_path
ynh_exec_as $app php$phpversion bin/console cache:clear -n
ynh_exec_as $app php$phpversion bin/console doctrine:migrations:migrate -n
# Create aeneria's user
for username in $(ynh_user_list)
do
mail=$(ynh_user_get_info --username=$username --key='mail')
user_exists=$(ynh_exec_as $app php$phpversion bin/console aeneria:user:exist "$mail")
if [ $user_exists -eq 0 ]
then
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass" -n
fi
done
# Set admin user
mail=$(ynh_user_get_info --username=$admin --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail" -n
mail=$(ynh_user_get_info --username="$admin" --key='mail')
user_exists=$(ynh_exec_as $app php$phpversion bin/console aeneria:user:exist "$mail")
if [ $user_exists -eq 0 ]
then
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass" -n
fi
# Regenerate RSA keys
ynh_exec_as $app php$phpversion bin/console aeneria:generate-key --force -n
@ -200,8 +193,8 @@ chmod 644 "/etc/cron.d/$app"
#=================================================
ynh_script_progression --message="Adapting hooks..." --weight=1
ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_user_create"
ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_user_delete"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess"
#=================================================
# RELOAD NGINX