1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moodle_ynh.git synced 2024-09-03 19:46:23 +02:00

Activate LDAP

This commit is contained in:
Kay0u 2020-03-24 18:19:49 +01:00
parent 2ee56f80c3
commit 69571b4f43
No known key found for this signature in database
GPG key ID: 7FF262C033518333
2 changed files with 32 additions and 0 deletions

View file

@ -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 # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.php" 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 # ADD CRON JOB
#================================================= #=================================================

View file

@ -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 "__FINAL_PATH__" "$final_path" "/etc/cron.d/$app"
ynh_replace_string "__YNH_PHP_VERSION__" "$YNH_PHP_VERSION" "/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 # SETUP SSOWAT
#================================================= #=================================================