1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yeswiki_ynh.git synced 2024-09-03 18:05:56 +02:00

Merge pull request #20 from nils-van-zuijlen/ldap

Add Ldap integration
This commit is contained in:
Nils Van Zuijlen 2021-04-16 10:33:44 +02:00 committed by GitHub
commit b13431daec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 15 deletions

View file

@ -24,7 +24,7 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=5f8249eef7d237106aad858ea91ed566d60c4019
upgrade=1 from_commit=e530bfcf7508e42be1b73ff0dcac8ed72428381b
backup_restore=1
multi_instance=1
port_already_use=1 (66)
@ -38,6 +38,6 @@
Email=
Notification=change
;;; Upgrade options
; commit=5f8249eef7d237106aad858ea91ed566d60c4019
; commit=e530bfcf7508e42be1b73ff0dcac8ed72428381b
name=Name of this previous version
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1&
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=password&is_public=1&

View file

@ -6,7 +6,7 @@
"en": "Wiki that is quick and easy to use.",
"fr": "Wiki facile et rapide à prendre en main."
},
"version": "2020-11-30-4~ynh1",
"version": "2020-11-30-4~ynh2",
"url": "https://yeswiki.net/",
"license": "AGPL-3.0-only",
"maintainer": {
@ -88,15 +88,6 @@
},
"choices": ["fr", "en", "ca", "es", "nl", "pt"],
"default": "fr"
},
{
"name": "password",
"type": "password",
"ask": {
"en": "Set the administrator password",
"fr": "Définissez le mot de passe administrateur"
}
}
]
}

View file

@ -9,6 +9,8 @@ YNH_PHP_VERSION="7.3"
# dependencies used by the app
extra_php_dependencies="php${YNH_PHP_VERSION}-zip"
loginldap_version="2021-03-01-2"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -30,7 +30,6 @@ admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
wiki_name=$YNH_APP_ARG_WIKI_NAME
language=$YNH_APP_ARG_LANGUAGE
password=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME
@ -128,10 +127,13 @@ ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Finalizing installation..." --weight=2
admin_temp_pass=$(ynh_string_random 6)
ynh_local_curl "/?PagePrincipale&installAction=install" "config[default_language]=$language" "config[wakka_name]=$wiki_name" \
"config[root_page]=PagePrincipale" "config[mysql_host]=localhost" \
"config[mysql_database]=$app" "config[mysql_user]=$db_user" "config[mysql_password]=$db_pwd" "config[table_prefix]=yeswiki_" \
"admin_name=$admin" "admin_password=$password" "admin_password_conf=$password" \
"admin_name=$admin" "admin_password=$admin_temp_pass" "admin_password_conf=$admin_temp_pass" \
"admin_email=$admin@$domain" "submit=Continue"
# authorization of html
@ -143,6 +145,33 @@ then
ynh_permission_update --permission main --remove visitors --add all_users
fi
#=================================================
# DOWNLOAD AND CONFIGURE LDAP PLUGIN
#=================================================
ynh_script_progression --message="Dowloading and configuring LDAP plugin" --weight=2
# Download from yeswiki repository
wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip 2>&1
wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip.md5 2>&1
md5sum -c extension-loginldap-$loginldap_version.zip.md5 || ynh_die "Checksum for LDAP plugin does not match"
unzip extension-loginldap-$loginldap_version.zip -d $final_path/tools
ynh_app_setting_set --app=$app --key=loginldap_version --value=$loginldap_version
# Add config at the end of wakka.config.php
ynh_replace_string --match_string=");"\
--replace_string=" 'ldap_host' => '127.0.0.1',\n);"\
--target_file="$final_path/wakka.config.php"
ynh_replace_string --match_string=");"\
--replace_string=" 'ldap_port' => '389',\n);"\
--target_file="$final_path/wakka.config.php"
ynh_replace_string --match_string=");"\
--replace_string=" 'ldap_base' => 'ou=users,dc=yunohost,dc=org'\n);"\
--target_file="$final_path/wakka.config.php"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -83,6 +83,37 @@ then
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
if [[ $(ynh_app_setting_get --app=$app --key=loginldap_version) != $loginldap_version ]]
then
ynh_script_progression --message="Upgrading LDAP plugin..." --weight=3
# Download LDAP plugin from yeswiki repository
wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip 2>&1
wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip.md5 2>&1
md5sum -c extension-loginldap-$loginldap_version.zip.md5 || ynh_die "Checksum for LDAP plugin does not match"
unzip -o extension-loginldap-$loginldap_version.zip -d $final_path/tools
ynh_app_setting_set --app=$app --key=loginldap_version --value=$loginldap_version
if ! grep -q "ldap_host" "$final_path/wakka.config.php"
then
# Add LDAP config at the end of wakka.config.php
ynh_replace_string --match_string=");"\
--replace_string=" 'ldap_host' => '127.0.0.1',\n);"\
--target_file="$final_path/wakka.config.php"
ynh_replace_string --match_string=");"\
--replace_string=" 'ldap_port' => '389',\n);"\
--target_file="$final_path/wakka.config.php"
ynh_replace_string --match_string=");"\
--replace_string=" 'ldap_base' => 'ou=users,dc=yunohost,dc=org'\n);"\
--target_file="$final_path/wakka.config.php"
fi
fi
#=================================================