1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dokuwiki_ynh.git synced 2024-09-03 18:26:20 +02:00

[enh] Add variable to handle authentication backend

This commit is contained in:
Gofannon 2018-09-28 23:01:55 +02:00
parent c05f795c29
commit bd578c05c3
3 changed files with 34 additions and 9 deletions

View file

@ -12,7 +12,7 @@
/* Authentication Settings */
$conf['useacl'] = 1; //Use Access Control Lists to restrict access?
$conf['authtype'] = 'authldap'; //which authentication backend should be used
$conf['authtype'] = '__YNH_AUTH_BACKEND__'; //which authentication backend should be used
$conf['passcrypt'] = 'sha1'; //Used crypt method (smd5,md5,sha1,ssha,crypt,mysql,my411)
$conf['superuser'] = '__YNH_ADMIN_USER__'; //The admin can be user or @group or comma separated list user1,@group1,user2
$conf['manager'] = '__YNH_ADMIN_USER__'; //The manager can be user or @group or comma separated list user1,@group1,user2

View file

@ -63,6 +63,17 @@ ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app language $language
#=================================================
# STORE DEFAULT VALUES FOR "ACTION SCRIPTS"
#=================================================
# Needed for "upgrade" to know which backend to set back after overwriting "local.protected.php"
# Can be changed by action script "internal_users"
auth_backend='authldap' # Default backend is LDAP with Yunohost, 'authldap' for DokuWiki
ynh_app_setting_set $app auth_backend $auth_backend
# Disable the 'is_internal_users' feature
ynh_app_setting_set $app is_internal_users 0
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -116,6 +127,8 @@ ynh_add_fpm_config
# It will only be updated by Yunohost package or directly by adventurous users
cp ../conf/local.protected.php $final_path/conf
# Set the authentification backend
ynh_replace_string "__YNH_AUTH_BACKEND__" "$auth_backend" "$final_path/conf/local.protected.php"
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"

View file

@ -23,6 +23,9 @@ is_public=$(ynh_app_setting_get $app is_public)
#language=$(ynh_app_setting_get $app language)
final_path=$(ynh_app_setting_get $app final_path)
auth_backend=$(ynh_app_setting_get $app auth_backend)
#is_internal_users=$(ynh_app_setting_get $app is_internal_users)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -55,6 +58,11 @@ if [ -z "$language" ]; then
ynh_app_setting_set $app language $language
fi
# 'is_internal_users' default value, if not set
if [ -z "$is_internal_users" ]; then
ynh_app_setting_set $app is_internal_users 0
fi
# Yunohost specific configuration, if not exists
@ -78,7 +86,9 @@ fi
if [ ! -f "$final_path/conf/local.protected.php" ]; then
cp ../conf/local.protected.php $final_path/conf
# Set the default "admin"
# Set the authentification backend
ynh_replace_string "__YNH_AUTH_BACKEND__" "$auth_backend" "$final_path/conf/local.protected.php"
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"
fi
@ -238,6 +248,8 @@ ynh_backup_if_checksum_is_different "$final_path/conf/local.protected.php"
# Always overwrite local file with the one from package.
cp ../conf/local.protected.php $final_path/conf
# Set the authentification backend
ynh_replace_string "__YNH_AUTH_BACKEND__" "$auth_backend" "$final_path/conf/local.protected.php"
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"