From e3041e62246f5f1a3191f6b8dd88171a57c7b4c8 Mon Sep 17 00:00:00 2001 From: Tagada <36127788+Tagadda@users.noreply.github.com> Date: Thu, 15 Jun 2023 04:43:19 +0200 Subject: [PATCH] sso --- conf/application.ini | 6 ++++-- manifest.toml | 7 +++++-- scripts/_common.sh | 3 +++ scripts/install | 22 ++++++++++++++++++++++ scripts/upgrade | 19 +++++++++++++++++++ sources/sso.php | 17 +++++++++++++++++ 6 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 sources/sso.php diff --git a/conf/application.ini b/conf/application.ini index e6b4af9..eeab652 100644 --- a/conf/application.ini +++ b/conf/application.ini @@ -17,10 +17,10 @@ allow_themes = On allow_user_background = Off ; Language used by default -language = "__LANGUAGE__" +language = "en" ; Admin Panel interface language -language_admin = "__LANGUAGE__" +language_admin = "en" ; Allow language selection on settings screen allow_languages_on_settings = On @@ -283,6 +283,8 @@ boundary_prefix = "" kolab_enabled = Off dev_email = "" dev_password = "" +custom_login_link='__PATH__/sso.php' +custom_logout_link='https://__MAIN_DOMAIN__/yunohost/sso/?action=logout' [version] current = "2.15.0" diff --git a/manifest.toml b/manifest.toml index e1cdc46..a38939e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -23,7 +23,7 @@ multi_instance = true ldap = false sso = false disk = "50M" -ram.build = "50M" +ram.build = "100M" ram.runtime = "50M" [install] @@ -55,5 +55,8 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" + [resources.database] + type = "mysql" + [resources.apt] - packages = "php8.2-sqlite3 php8.2-tidy php8.2-dom php8.2-intl php8.2-mysql php8.2-curl php8.2-gd php8.2-cli php8.2-xml php8.2-mbstring" + packages = "mariadb-server php8.2-sqlite3 php8.2-tidy php8.2-dom php8.2-intl php8.2-mysql php8.2-curl php8.2-gd php8.2-cli php8.2-xml php8.2-mbstring" diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..7e974aa 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,9 @@ # COMMON VARIABLES #================================================= +main_domain=$(cat /etc/yunohost/current_host) +timezone=$(cat /etc/timezone) + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index e975d1d..7ee25ff 100755 --- a/scripts/install +++ b/scripts/install @@ -50,6 +50,28 @@ ynh_add_nginx_config # Use logrotate to manage application logfile(s) ynh_use_logrotate +#================================================= +# APP INITIAL CONFIGURATION +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +mkdir -p "$install_dir/data/_data_/_default_/configs" +chown $app:$app -R "$install_dir/data/_data_" + +ynh_add_config --template="application.ini" --destination="$install_dir/data/_data_/_default_/configs/application.ini" + +chmod 400 "$install_dir/data/_data_/_default_/configs/application.ini" +chown $app:$app "$install_dir/data/_data_/_default_/configs/application.ini" + +#================================================= +# SETUP SSO +#================================================= +ynh_script_progression --message="Applying SSO patch..." --weight=1 + +ynh_add_config --template="../sources/sso.php" --destination="$install_dir/sso.php" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2b3636a..c7fa8da 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,6 +67,25 @@ ynh_add_nginx_config # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append +#================================================= +# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +ynh_add_config --template="application.ini" --destination="$install_dir/data/_data_/_default_/configs/application.ini" + +chmod 400 "$install_dir/data/_data_/_default_/configs/application.ini" +chown $app:$app "$install_dir/data/_data_/_default_/configs/application.ini" + +#================================================= +# SETUP SSO +#================================================= +ynh_script_progression --message="Applying SSO patch..." --weight=1 + +ynh_add_config --template="../sources/sso.php" --destination="$install_dir/sso.php" + #================================================= # END OF SCRIPT #================================================= diff --git a/sources/sso.php b/sources/sso.php new file mode 100644 index 0000000..44356f6 --- /dev/null +++ b/sources/sso.php @@ -0,0 +1,17 @@ +