mirror of
https://github.com/YunoHost-Apps/wikijs_ynh.git
synced 2024-09-03 20:36:09 +02:00
fix ldap firstname and lastname
This commit is contained in:
parent
5c404af2e1
commit
0015f5b6d5
4 changed files with 5 additions and 28 deletions
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_send_readme_to_admin__2
|
source ynh_send_readme_to_admin__2
|
||||||
source ynh_sanitize_name
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -31,7 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
ldap_user=$(ynh_sanitize_name --name="${app}ldap")
|
ldap_user="svc_${app}_ldap"
|
||||||
ldap_password=$(ynh_string_random --length=8)
|
ldap_password=$(ynh_string_random --length=8)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -121,7 +120,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Creating LDAP user..."
|
ynh_print_info --message="Creating LDAP user..."
|
||||||
|
|
||||||
yunohost user create $ldap_user --firstname $ldap_user --lastname $ldap_user --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
|
|
@ -125,7 +125,7 @@ sleep 30
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Creating LDAP user..."
|
ynh_print_info --message="Creating LDAP user..."
|
||||||
|
|
||||||
yunohost user create $ldap_user --firstname $ldap_user --lastname $ldap_user --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -63,11 +63,11 @@ fi
|
||||||
|
|
||||||
# If ldap_user doesn't exist, retrieve it or create it
|
# If ldap_user doesn't exist, retrieve it or create it
|
||||||
if [[ -z "$ldap_user" ]]; then
|
if [[ -z "$ldap_user" ]]; then
|
||||||
ldap_user=$(ynh_sanitize_name --name="${app}ldap")
|
ldap_user="svc_${app}_ldap"
|
||||||
ldap_password=$(ynh_string_random --length=8)
|
ldap_password=$(ynh_string_random --length=8)
|
||||||
ynh_app_setting_set "$app" ldap_user "$ldap_user"
|
ynh_app_setting_set "$app" ldap_user "$ldap_user"
|
||||||
ynh_app_setting_set "$app" ldap_password "$ldap_password"
|
ynh_app_setting_set "$app" ldap_password "$ldap_password"
|
||||||
yunohost user create $ldap_user --firstname $app --lastname $app --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove yarn repository
|
# Remove yarn repository
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Sanitize a string intended to be the firstname lastname
|
|
||||||
# (More specifically : removing - . and _)
|
|
||||||
#
|
|
||||||
# example: username=$(ynh_sanitize_name --name=$app)
|
|
||||||
#
|
|
||||||
# usage: ynh_sanitize_name --name=name
|
|
||||||
# | arg: -n, --name - name to correct/sanitize
|
|
||||||
# | ret: the corrected name
|
|
||||||
#
|
|
||||||
ynh_sanitize_name () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
local legacy_args=n
|
|
||||||
declare -Ar args_array=( [n]=name= )
|
|
||||||
local name
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
# We should avoid having - and . in the name of databases. They are replaced by _
|
|
||||||
echo ${name//[-._]/}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue