From 51ddcd64d68398018e3af6637339e2c20c4dc9a7 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 18 Feb 2018 16:38:26 +0100 Subject: [PATCH] ldap support for mypads --- check_process | 8 ++++---- conf/settings.json | 24 ++++++++++++++++++++++++ manifest.json | 13 +++++++++++++ scripts/install | 10 +++++++++- 4 files changed, 50 insertions(+), 5 deletions(-) diff --git a/check_process b/check_process index d1c332c..ce11686 100644 --- a/check_process +++ b/check_process @@ -1,5 +1,4 @@ ;; Test complet avec libreoffice sans mypads - auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) @@ -9,6 +8,7 @@ is_public=1 (PUBLIC|public=1|private=0) export="libreoffice" mypads=0 + useldap=0 ; Checks pkg_linter=1 setup_sub_dir=1 @@ -23,7 +23,6 @@ port_already_use=1 (9001) change_url=1 ;; Test avec mypads - auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) @@ -33,13 +32,13 @@ is_public=1 (PUBLIC|public=1|private=0) export="libreoffice" mypads=1 + useldap=1 ; Checks setup_root=1 upgrade=1 upgrade=1 from_commit=8bf300413ec3adcb416d168d2e9e98975dd9405b backup_restore=1 ;; Test abiword - auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) @@ -49,10 +48,10 @@ is_public=1 (PUBLIC|public=1|private=0) export="abiword" mypads=1 + useldap=0 ; Checks setup_root=1 ;; Test sans export - auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) @@ -62,6 +61,7 @@ is_public=1 (PUBLIC|public=1|private=0) export="none" mypads=1 + useldap=0 ; Checks setup_root=1 ;;; Levels diff --git a/conf/settings.json b/conf/settings.json index 8292a2d..c5ba108 100644 --- a/conf/settings.json +++ b/conf/settings.json @@ -87,6 +87,30 @@ "ep_comments_page": { "highlightSelectedText": false }, + // ep_mypads +//noldap "ep_mypads": { +//noldap "ldap": { +//noldap // Your LDAP URL +//noldap "url": "ldap://127.0.0.1", +//noldap // Where to search your users +//noldap "searchBase": "ou=users,dc=yunohost,dc=org", +//noldap // A LDAP filter ({{username}} is replaced by user's login) +//noldap "searchFilter": "(&(|(objectclass=posixAccount))(uid={{username}}))", +//noldap // LDAP properties mapping for MyPads +//noldap "properties": { +//noldap // Which LDAP property will be used as user's login? +//noldap "login": "uid", +//noldap // as user's email +//noldap "email": "mail", +//noldap // as user's firstname +//noldap "firstname": "givenName", +//noldap // as users's lastname +//noldap "lastname": "sn" +//noldap }, +//noldap // Default langage for LDAP created users +//noldap "defaultLang": "__LANGUAGE__" +//noldap } +//noldap }, /* Should we suppress errors from being visible in the default Pad Text? */ "suppressErrorsInPadText" : false, diff --git a/manifest.json b/manifest.json index 233d79d..d9a25a0 100644 --- a/manifest.json +++ b/manifest.json @@ -102,6 +102,19 @@ "en": "mypads plugin" }, "default": true + }, + { + "name": "useldap", + "type": "boolean", + "ask": { + "en": "Do you want to use ldap with mypads ?", + "fr": "Voulez-vous utiliser ldap avec mypads ?" + }, + "help": { + "en": "Using ldap won't let you add new user aside from YunoHost users.", + "fr": "Utiliser ldap ne vous permettra pas d'ajouter un nouvel utilisateur en dehors des utilisateurs de YunoHost." + }, + "default": true } ] } diff --git a/scripts/install b/scripts/install index e8b05d5..d87589b 100644 --- a/scripts/install +++ b/scripts/install @@ -10,7 +10,6 @@ source _common.sh source /usr/share/yunohost/helpers # Load common variables for all scripts. source _variables -source _sed #================================================= # MANAGE FAILURE OF THE SCRIPT @@ -34,6 +33,7 @@ language=$YNH_APP_ARG_LANGUAGE is_public=$YNH_APP_ARG_IS_PUBLIC export=$YNH_APP_ARG_EXPORT mypads=$YNH_APP_ARG_MYPADS +useldap=$YNH_APP_ARG_USELDAP app=$YNH_APP_INSTANCE_NAME @@ -76,6 +76,7 @@ ynh_print_OFF; ynh_app_setting_set $app password $password; ynh_print_ON ynh_app_setting_set $app language $language ynh_app_setting_set $app export $export ynh_app_setting_set $app mypads $mypads +ynh_app_setting_set $app useldap $useldap #================================================= # STANDARD MODIFICATIONS @@ -180,6 +181,13 @@ then ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad fi ynh_replace_string "__LANGUAGE__" "$language" "$final_path/settings.json" + +# Use ldap for mypads +if [ $mypads -eq 1 ] && [ $useldap -eq 1 ] +then + ynh_replace_string "//noldap" "" "$final_path/settings.json" +fi + ynh_store_file_checksum "$final_path/settings.json" # Enregistre la somme de contrĂ´le du fichier de config ynh_store_file_checksum "$final_path/credentials.json" # Enregistre la somme de contrĂ´le du fichier de config