diff --git a/scripts/install b/scripts/install index a66333b..354f887 100644 --- a/scripts/install +++ b/scripts/install @@ -134,6 +134,22 @@ exec_as "$app" php$YNH_PHP_VERSION "$final_path/admin/cli/install.php" --wwwroot # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/config.php" +#================================================= +# ACTIVATE LDAP SUPPORT +#================================================= + +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config SET value='ldap,email' WHERE name='auth';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='ldap://127.0.0.1/' WHERE plugin='auth_ldap' AND name='host_url';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='uid' WHERE plugin='auth_ldap' AND name='user_attribute';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='ou=users,dc=yunohost,dc=org' WHERE plugin='auth_ldap' AND name='contexts';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='givenName' WHERE plugin='auth_ldap' AND name='field_map_firstname';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='sn' WHERE plugin='auth_ldap' AND name='field_map_lastname';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='mail' WHERE plugin='auth_ldap' AND name='field_map_email';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='onlogin' WHERE plugin='auth_ldap' AND (name='field_updatelocal_firstname' OR name='field_updatelocal_lastname' OR name='field_updatelocal_email');" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='locked' WHERE plugin='auth_ldap' AND (name='field_lock_firstname' OR name='field_lock_lastname' OR name='field_lock_email');" + +exec_as "$app" php$YNH_PHP_VERSION "$final_path/admin/cli/purge_caches.php" + #================================================= # ADD CRON JOB #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d7e6974..8ef0ae2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,6 +134,22 @@ sudo cp "../conf/cron" "/etc/cron.d/$app" ynh_replace_string "__FINAL_PATH__" "$final_path" "/etc/cron.d/$app" ynh_replace_string "__YNH_PHP_VERSION__" "$YNH_PHP_VERSION" "/etc/cron.d/$app" +#================================================= +# ACTIVATE LDAP SUPPORT +#================================================= + +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config SET value='ldap,email' WHERE name='auth';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='ldap://127.0.0.1/' WHERE plugin='auth_ldap' AND name='host_url';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='uid' WHERE plugin='auth_ldap' AND name='user_attribute';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='ou=users,dc=yunohost,dc=org' WHERE plugin='auth_ldap' AND name='contexts';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='givenName' WHERE plugin='auth_ldap' AND name='field_map_firstname';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='sn' WHERE plugin='auth_ldap' AND name='field_map_lastname';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='mail' WHERE plugin='auth_ldap' AND name='field_map_email';" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='onlogin' WHERE plugin='auth_ldap' AND (name='field_updatelocal_firstname' OR name='field_updatelocal_lastname' OR name='field_updatelocal_email');" +ynh_psql_execute_as_root --database=$db_name --sql="UPDATE public.mdl_config_plugins SET value='locked' WHERE plugin='auth_ldap' AND (name='field_lock_firstname' OR name='field_lock_lastname' OR name='field_lock_email');" + +exec_as "$app" php$YNH_PHP_VERSION "$final_path/admin/cli/purge_caches.php" + #================================================= # SETUP SSOWAT #=================================================