1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/prettynoemiecms_ynh.git synced 2024-09-03 20:06:36 +02:00

Merge pull request #15 from YunoHost-Apps/new-permission

Set new permission
This commit is contained in:
Éric Gaspar 2021-05-01 14:37:53 +02:00 committed by GitHub
commit 8657e776e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 91 additions and 121 deletions

View file

@ -1,12 +1,12 @@
# PrettyNoemieCMS for YunoHost
[![Integration level](https://dash.yunohost.org/integration/prettynoemiecms.svg)](https://dash.yunohost.org/appci/app/prettynoemiecms) ![](https://ci-apps.yunohost.org/ci/badges/prettynoemiecms.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/prettynoemiecms.maintain.svg)
[![Install PrettyNoemieCMS with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=prettynoemiecms)
[![Install PrettyNoemieCMS with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=prettynoemiecms)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install PrettyNoemieCMS quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
If you don't have YunoHost, please see [here](https://yunohost.org/install) to know how to install and enjoy it.*
## Overview
PrettyNoemieCMS offers its users an ergonomic solution, simple and elegant to build in no time responsive windows sites with modern design.
@ -45,8 +45,8 @@ Can the app be used by multiple users? **No**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/prettynoemiecms%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/prettynoemiecms/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/prettynoemiecms%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/prettynoemiecms/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/prettynoemiecms.svg)](https://ci-apps.yunohost.org/ci/apps/prettynoemiecms/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/prettynoemiecms.svg)](https://ci-apps-arm.yunohost.org/ci/apps/prettynoemiecms/)
## Links

View file

@ -1,12 +1,12 @@
# PrettyNoemieCMS pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/prettynoemiecms.svg)](https://dash.yunohost.org/appci/app/prettynoemiecms)
[![Install prettynoemiecms with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=prettynoemiecms)
[![Install prettynoemiecms with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=prettynoemiecms)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer prettynoemiecms rapidement et simplement sur un serveur Yunohost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
CMS offrant à ses utilisateurs une solution ergonomique, simple et élégante pour construire en un rien de temps des sites vitrines responsives au design moderne.
@ -40,17 +40,13 @@ Comment configurer cette application: via le panneau d'administration à : `votr
#### Support multi-utilisateurs
L'authentification LDAP et HTTP est-elle prise en charge? **NON**
L'application peut-elle être utilisée par plusieurs utilisateurs? **NON**
L'authentification LDAP et HTTP est-elle prise en charge? **Non**
L'application peut-elle être utilisée par plusieurs utilisateurs? **Non**
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/prettynoemiecms%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/prettynoemiecms/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/prettynoemiecms%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/prettynoemiecms/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/prettynoemiecms%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/prettynoemiecms/)
**Plus d'informations sur la page de documentation:**
https://yunohost.org/packaging_apps
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/prettynoemiecms.svg)](https://ci-apps.yunohost.org/ci/apps/prettynoemiecms/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/prettynoemiecms.svg)](https://ci-apps-arm.yunohost.org/ci/apps/prettynoemiecms/)
## Liens
@ -61,10 +57,8 @@ https://yunohost.org/packaging_apps
---
Informations pour les développeurs
----------------
# Informations pour les développeurs
**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.**
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/prettynoemiecms_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.

View file

@ -14,13 +14,14 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=a2309f4c622bab3b728e765b125245ebf55f3f59
backup_restore=1
multi_instance=1
incorrect_path=1
port_already_use=0
change_url=1
;;; Levels
Level 5=auto
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=a2309f4c622bab3b728e765b125245ebf55f3f59
name=Merge pull request #13 from YunoHost-Apps/testing
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -14,50 +14,34 @@
"email": "pierre@kayou.io"
},
"requirements": {
"yunohost": ">= 3.5"
"yunohost": ">= 4.1.7"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm"
"php7.3-fpm"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for prettynoemiecms",
"fr": "Choisissez un nom de domaine pour prettynoemiecms"
},
"example": "example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for prettynoemiecms",
"fr": "Choisissez un chemin pour prettynoemiecms"
},
"example": "/prettynoemiecms",
"default": "/prettynoemiecms"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
},
"example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
},
{
@ -73,14 +57,6 @@
{
"name": "password",
"type": "password",
"ask": {
"en": "Set the administrator password",
"fr": "Définissez le mot de passe administrateur"
},
"help": {
"en": "Use the help field to add an information for the admin about this question.",
"fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
},
"example": "Choose a password"
}
]

View file

@ -4,8 +4,12 @@
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
# dependencies used by the app
pkg_dependencies="php7.0-cli php7.0-common php7.0-intl php7.0-json git"
extra_php_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json"
pkg_dependencies="git"
#=================================================
# PERSONAL HELPERS
@ -34,7 +38,7 @@ ynh_composer_exec () {
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
phpversion="${phpversion:-7.3}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \

View file

@ -23,38 +23,41 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..." --weight=1
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up php-fpm configuration..." --weight=1
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -29,6 +29,22 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
@ -50,7 +66,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -76,14 +92,13 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# MOVE FOLDER IF NECESSARY
#=================================================
# Change the domain for nginx
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
@ -98,7 +113,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -52,7 +52,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=language --value=$language
#=================================================
@ -76,7 +75,7 @@ ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=1
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
@ -92,10 +91,11 @@ ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring php-fpm..." --weight=1
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated php-fpm config
ynh_add_fpm_config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
@ -123,13 +123,10 @@ chown -R $app: $final_path
# SETUP APPLICATION WITH CURL
#=================================================
# Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." --weight=1
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
# Reload SSOwat config
yunohost app ssowatconf
# Set the app as temporarily public for cURL call
ynh_permission_update --permission="main" --add="visitors"
# Reload Nginx
# Reload NGINX
ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl
@ -137,7 +134,7 @@ ynh_script_progression --message="Finalizing installation..." --weight=2
ynh_local_curl "/signIn" "username=$admin" "password=$password" "repeatPassword=$password"
# Remove the public access
ynh_app_setting_delete --app=$app --key=skipped_uris
ynh_permission_update --permission="main" --remove="visitors"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -154,21 +151,20 @@ ynh_replace_string --match_string="isMediaPathModified = true" --replace_string=
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
# protect the admin panel
ynh_app_setting_set --app=$app --key=protected_uris --value="/admin"
ynh_permission_update --permission="main" --add="visitors"
# Only the admin can access the admin panel of the app (if the app has an admin panel)
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -41,7 +41,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -49,7 +49,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing php-fpm configuration..." --weight=1
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated php-fpm config
ynh_remove_fpm_config

View file

@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -74,8 +75,11 @@ chown -R $app: $final_path
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=2
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# SPECIFIC RESTORATION
@ -92,9 +96,9 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -19,9 +19,9 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
@ -34,21 +34,24 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -63,18 +66,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
# N.B. : this is for app installations before YunoHost 2.7
# where this value might be something like /foo/ or foo/
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -92,7 +83,7 @@ fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
@ -115,7 +106,7 @@ ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated php-fpm config
ynh_add_fpm_config
@ -142,24 +133,10 @@ ynh_replace_string --match_string="isMediaPathModified = true" --replace_string=
# Set permissions on app files
chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
# protect the admin panel
ynh_app_setting_set --app=$app --key=protected_uris --value="/admin"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload