Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New permissions #51

Merged
merged 8 commits into from May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion check_process
Expand Up @@ -19,7 +19,6 @@
upgrade=1
backup_restore=1
multi_instance=0
incorrect_path=1
port_already_use=0
change_url=1
;;; Options
Expand Down
4 changes: 1 addition & 3 deletions pull_request_template.md
Expand Up @@ -13,6 +13,4 @@

## 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*

[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/onlyoffice_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/onlyoffice_ynh%20PR-NUM-%20(USERNAME)/)
* 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!"*
2 changes: 1 addition & 1 deletion scripts/_common.sh
Expand Up @@ -5,7 +5,7 @@
#=================================================

# dependencies used by the app
pkg_dependencies="postgresql libstdc++6 redis-server rabbitmq-server libcurl4-dev"
pkg_dependencies="postgresql postgresql-contrib libstdc++6 redis-server rabbitmq-server libcurl4-dev"

#=================================================
# PERSONAL HELPERS
Expand Down
21 changes: 5 additions & 16 deletions scripts/install
Expand Up @@ -47,6 +47,7 @@ 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=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=nextclouddomain --value=$nextclouddomain
ynh_app_setting_set --app=$app --key=final_path --value=$final_path

#=================================================
# STANDARD MODIFICATIONS
Expand All @@ -72,7 +73,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq
#=================================================
ynh_script_progression --message="Installing dependencies..."

ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies

#=================================================
# CREATE A POSTGRESQL DATABASE
Expand All @@ -81,20 +82,9 @@ ynh_script_progression --message="Creating a PostgreSQL database..."

db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=32)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."

ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
#ynh_setup_source --dest_dir="$final_path"
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name

#=================================================
# NGINX CONFIGURATION
Expand Down Expand Up @@ -178,13 +168,12 @@ ynh_script_progression --message="Generating fonts..."
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring permissions..."

# 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="/"
ynh_permission_update --permission="main" --add="visitors"
fi

#=================================================
Expand Down
5 changes: 2 additions & 3 deletions scripts/restore
Expand Up @@ -26,10 +26,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)

db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)

Expand Down Expand Up @@ -74,7 +73,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq
ynh_script_progression --message="Reinstalling dependencies..."

# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies

#=================================================
# RESTORE THE POSTGRESQL DATABASE
Expand Down
23 changes: 9 additions & 14 deletions scripts/upgrade
Expand Up @@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ericgaspar marked this conversation as resolved.
Show resolved Hide resolved
port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)

Expand Down Expand Up @@ -51,6 +51,13 @@ if [ -z "$final_path" ]; then
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

ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list"
ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list"

Expand Down Expand Up @@ -89,7 +96,7 @@ ynh_add_nginx_config "nextclouddomain"
#=================================================
ynh_script_progression --message="Upgrading dependencies..."

ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies

#=================================================
# CREATE DEDICATED USER
Expand Down Expand Up @@ -149,18 +156,6 @@ ynh_script_progression --message="Generating fonts..."

#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..."

# 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 ONLYOFFICE
#=================================================
Expand Down