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:
parent
c05f795c29
commit
bd578c05c3
3 changed files with 34 additions and 9 deletions
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* This file is used for configuration settings which cannot be modified by Dokuwiki admin panel
|
||||
* See here for explanations : https://www.dokuwiki.org/config
|
||||
*
|
||||
*
|
||||
* Yunohost dedicated settings are stored here in order to be able to upgrade the Yunohost package safely latter for Yunohost packager ( Yeah \o/ )
|
||||
*
|
||||
* You should not modify this file direclty as it will be overwritten by Yunohost package
|
||||
|
@ -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
|
||||
|
|
|
@ -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,22 +127,24 @@ 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"
|
||||
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"
|
||||
|
||||
|
||||
# This file might be modified by dokuwiki admin panel or by plugins
|
||||
# It will not be modified by Yunohost in order to keep user settings
|
||||
cp ../conf/local.php $final_path/conf
|
||||
cp ../conf/local.php $final_path/conf
|
||||
|
||||
# Set the "language"
|
||||
ynh_replace_string "__YNH_LANGUAGE__" "$language" "$final_path/conf/local.php"
|
||||
ynh_replace_string "__YNH_LANGUAGE__" "$language" "$final_path/conf/local.php"
|
||||
|
||||
|
||||
# Restrict user rights by enforcing "read-only" mode for all users
|
||||
# See https://www.dokuwiki.org/acl#background_info
|
||||
# Default is "8"
|
||||
cp ../conf/acl.auth.php $final_path/conf
|
||||
cp ../conf/acl.auth.php $final_path/conf
|
||||
|
||||
#=================================================
|
||||
# CREATE DEFAULT FILES
|
||||
|
|
|
@ -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,8 +86,10 @@ fi
|
|||
if [ ! -f "$final_path/conf/local.protected.php" ]; then
|
||||
cp ../conf/local.protected.php $final_path/conf
|
||||
|
||||
# Set the default "admin"
|
||||
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"
|
||||
# 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
|
||||
|
||||
# Do not overwrite existing dokuwiki configuration as it could have user customization's and settings.
|
||||
|
@ -238,8 +248,10 @@ 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"
|
||||
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$final_path/conf/local.protected.php"
|
||||
|
|
Loading…
Add table
Reference in a new issue