mirror of
https://github.com/YunoHost-Apps/framaforms_ynh.git
synced 2024-09-03 18:36:12 +02:00
Merge pull request #40 from YunoHost-Apps/new-permissions
New permissions
This commit is contained in:
commit
b74fb1a5ff
10 changed files with 103 additions and 112 deletions
|
@ -33,8 +33,8 @@ You can modify some configurations using the Framaforms administration panel. Yo
|
||||||
|
|
||||||
#### Multi-user support
|
#### Multi-user support
|
||||||
|
|
||||||
Are LDAP and HTTP auth supported? **Only LDAP**
|
* Are LDAP and HTTP auth supported? **Only LDAP**
|
||||||
Can the app be used by multiple users? **Yes**
|
* Can the app be used by multiple users? **Yes**
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ about: Create a report to help us debug, it would be nice to fill the template a
|
||||||
1. *Read this whole template first.*
|
1. *Read this whole template first.*
|
||||||
2. *Determine if you are on the right place:*
|
2. *Determine if you are on the right place:*
|
||||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||||
- *Otherwise, the issue may be due to framaforms itself. Refer to its documentation or repository for help.*
|
- *Otherwise, the issue may be due to Framaforms itself. Refer to its documentation or repository for help.*
|
||||||
- *If you have a doubt, post here, we will figure it out together.*
|
- *If you have a doubt, post here, we will figure it out together.*
|
||||||
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||||
---
|
---
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
"en": "Create online webforms and surveys",
|
"en": "Create online webforms and surveys",
|
||||||
"fr": "Créez des formulaires et questionnaires en ligne"
|
"fr": "Créez des formulaires et questionnaires en ligne"
|
||||||
},
|
},
|
||||||
"version": "1.0.3~ynh1",
|
"version": "1.0.3~ynh2",
|
||||||
"url": "https://framagit.org/framasoft/framaforms",
|
"url": "https://framagit.org/framasoft/framaforms",
|
||||||
"license": "GPL-2.0-only",
|
"license": "GPL-2.0-only",
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.8.1"
|
"yunohost": ">= 4.0.0"
|
||||||
},
|
},
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "ljf",
|
"name": "ljf",
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php7.0-fpm",
|
"php7.3-fpm",
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
"en": "Choose the application language",
|
"en": "Choose the application language",
|
||||||
"fr": "Choisissez la langue de l'application"
|
"fr": "Choisissez la langue de l'application"
|
||||||
},
|
},
|
||||||
"choices": ["fr", "en"],
|
"choices": ["de", "en", "es", "fr", "it", "pt"],
|
||||||
"default": "en"
|
"default": "en"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,4 @@
|
||||||
|
|
||||||
## Package_check results
|
## Package_check results
|
||||||
---
|
---
|
||||||
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
|
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
|
||||||
|
|
||||||
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/framaforms_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/framaforms_ynh%20PR-NUM-%20(USERNAME)/)
|
|
||||||
|
|
|
@ -22,3 +22,66 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-cli php$
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
|
||||||
|
# Declare the actual composer version to use.
|
||||||
|
# A packager willing to use another version of composer can override the variable into its _common.sh.
|
||||||
|
YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
|
||||||
|
|
||||||
|
# Execute a command with Composer
|
||||||
|
#
|
||||||
|
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
|
||||||
|
# | arg: -v, --phpversion - PHP version to use with composer
|
||||||
|
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
||||||
|
# | arg: -c, --commands - Commands to execute.
|
||||||
|
ynh_composer_exec () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=vwc
|
||||||
|
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
|
||||||
|
local phpversion
|
||||||
|
local workdir
|
||||||
|
local commands
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
workdir="${workdir:-$final_path}"
|
||||||
|
phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
||||||
|
|
||||||
|
COMPOSER_HOME="$workdir/.composer" \
|
||||||
|
php${phpversion} "$workdir/composer.phar" $commands \
|
||||||
|
-d "$workdir" --quiet --no-interaction
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install and initialize Composer in the given directory
|
||||||
|
#
|
||||||
|
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
|
||||||
|
# | arg: -v, --phpversion - PHP version to use with composer
|
||||||
|
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
||||||
|
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
|
||||||
|
# | arg: -c, --composerversion - Composer version to install
|
||||||
|
ynh_install_composer () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=vwa
|
||||||
|
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
|
||||||
|
local phpversion
|
||||||
|
local workdir
|
||||||
|
local install_args
|
||||||
|
local composerversion
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
workdir="${workdir:-$final_path}"
|
||||||
|
phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
||||||
|
install_args="${install_args:-}"
|
||||||
|
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
|
||||||
|
|
||||||
|
curl -sS https://getcomposer.org/installer \
|
||||||
|
| COMPOSER_HOME="$workdir/.composer" \
|
||||||
|
php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|
||||||
|
|| ynh_die "Unable to install Composer."
|
||||||
|
|
||||||
|
# update dependencies to create composer.lock
|
||||||
|
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|
||||||
|
|| ynh_die "Unable to update core dependencies with Composer."
|
||||||
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_composer__2
|
|
||||||
source ynh_exec_as
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -26,7 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
admin=admin
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
expiration=$YNH_APP_ARG_EXPIRATION
|
expiration=$YNH_APP_ARG_EXPIRATION
|
||||||
deletion=$YNH_APP_ARG_DELETION
|
deletion=$YNH_APP_ARG_DELETION
|
||||||
|
@ -188,11 +186,11 @@ ynh_script_progression --message="Installing database..." --weight=19
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php$phpversion
|
update-alternatives --set php /usr/bin/php$phpversion
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app site-install framaforms_org install_configure_form.site_contact_url="https://forum.yunohost.org/t/framaforms-create-polls-using-drag-and-drop/8208" install_configure_form.site_default_country=FR -y --locale="$language" --account-name="admin" --account-pass="$password" --site-name="Framaforms" --site-mail="$admin_mail" 2>&1
|
sudo -u $app env PATH=$PATH drush @$app site-install framaforms_org install_configure_form.site_contact_url="https://forum.yunohost.org/t/framaforms-create-polls-using-drag-and-drop/8208" install_configure_form.site_default_country=FR -y --locale="$language" --account-name="admin" --account-pass="$password" --site-name="Framaforms" --site-mail="$admin_mail" 2>&1
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set update_notify_emails "$admin_mail"
|
sudo -u $app env PATH=$PATH drush @$app variable-set update_notify_emails "$admin_mail"
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" 2>&1
|
sudo -u $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" 2>&1
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app pm-enable framaforms_feature -y --resolve-dependencies 2>&1
|
sudo -u $app env PATH=$PATH drush @$app pm-enable framaforms_feature -y --resolve-dependencies 2>&1
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app php-eval "module_load_include('inc', 'framaforms', 'includes/framaforms.pages');create_all_pages();" 2>&1 || true
|
sudo -u $app env PATH=$PATH drush @$app php-eval "module_load_include('inc', 'framaforms', 'includes/framaforms.pages');create_all_pages();" 2>&1 || true
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORTING LANGUAGE PACK
|
# IMPORTING LANGUAGE PACK
|
||||||
|
@ -271,17 +269,19 @@ chown -R $app: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
ynh_permission_create --permission "admin" --url /admin/
|
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# Everyone can access the app.
|
||||||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
# The "main" permission is automatically created before the install script.
|
||||||
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source ../settings/scripts/ynh_composer__2
|
|
||||||
source ../settings/scripts/ynh_exec_as
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_composer__2
|
|
||||||
source ynh_exec_as
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -22,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
|
@ -58,6 +57,18 @@ if [ -z "$final_path" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
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
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -143,12 +154,12 @@ then
|
||||||
update-alternatives --set php /usr/bin/php$phpversion
|
update-alternatives --set php /usr/bin/php$phpversion
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
|
sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
|
sudo -u $app env PATH=$PATH drush @$app cache-clear all
|
||||||
# ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal
|
# sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal
|
||||||
# ynh_exec_as $app env PATH=$PATH drush @$app updatedb -y
|
# sudo -u $app env PATH=$PATH drush @$app updatedb -y
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
|
sudo -u $app env PATH=$PATH drush @$app cache-clear all
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
|
sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
|
||||||
popd
|
popd
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
|
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
|
||||||
|
@ -180,18 +191,6 @@ mkdir -p "/home/yunohost.app/$app/data"
|
||||||
chown -R $app: "/home/yunohost.app/$app/data"
|
chown -R $app: "/home/yunohost.app/$app/data"
|
||||||
chmod 775 "/home/yunohost.app/$app/data"
|
chmod 775 "/home/yunohost.app/$app/data"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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="/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Execute a command with Composer
|
|
||||||
#
|
|
||||||
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
|
|
||||||
# | arg: -v, --phpversion - PHP version to use with composer
|
|
||||||
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
|
||||||
# | arg: -c, --commands - Commands to execute.
|
|
||||||
ynh_composer_exec () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
local legacy_args=vwc
|
|
||||||
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
|
|
||||||
local phpversion
|
|
||||||
local workdir
|
|
||||||
local commands
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
workdir="${workdir:-$final_path}"
|
|
||||||
phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
|
||||||
|
|
||||||
COMPOSER_HOME="$workdir/.composer" \
|
|
||||||
php${phpversion} "$workdir/composer.phar" $commands \
|
|
||||||
-d "$workdir" --quiet --no-interaction
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install and initialize Composer in the given directory
|
|
||||||
#
|
|
||||||
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"]
|
|
||||||
# | arg: -v, --phpversion - PHP version to use with composer
|
|
||||||
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
|
||||||
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
|
|
||||||
ynh_install_composer () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
local legacy_args=vwa
|
|
||||||
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args=)
|
|
||||||
local phpversion
|
|
||||||
local workdir
|
|
||||||
local install_args
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
workdir="${workdir:-$final_path}"
|
|
||||||
phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
|
||||||
install_args="${install_args:-}"
|
|
||||||
|
|
||||||
curl -sS https://getcomposer.org/installer \
|
|
||||||
| COMPOSER_HOME="$workdir/.composer" \
|
|
||||||
php${phpversion} -- --quiet --install-dir="$workdir" \
|
|
||||||
|| ynh_die "Unable to install Composer."
|
|
||||||
|
|
||||||
# update dependencies to create composer.lock
|
|
||||||
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|
|
||||||
|| ynh_die "Unable to update core dependencies with Composer."
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Execute a command as another user
|
|
||||||
# usage: exec_as USER COMMAND [ARG ...]
|
|
||||||
ynh_exec_as() {
|
|
||||||
local USER=$1
|
|
||||||
shift 1
|
|
||||||
|
|
||||||
if [[ $USER = $(whoami) ]]; then
|
|
||||||
eval "$@"
|
|
||||||
else
|
|
||||||
sudo -u "$USER" "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
Loading…
Reference in a new issue