From 1fcae428eaeef8ab3ff52f18b33f4789d14f061d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 25 Oct 2023 22:45:27 +0200 Subject: [PATCH] cleaning --- conf/db-ldap.sql | 13 +++++++++++++ scripts/install | 2 ++ scripts/upgrade | 5 ++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 conf/db-ldap.sql diff --git a/conf/db-ldap.sql b/conf/db-ldap.sql new file mode 100644 index 0000000..eff8568 --- /dev/null +++ b/conf/db-ldap.sql @@ -0,0 +1,13 @@ +INSERT INTO public.auth_sources(type, name, host, port, base_dn, attr_login, attr_firstname, attr_lastname, attr_mail, onthefly_register, filter) VALUES ( + 'AuthSourceLdap', + 'yunohost', + 'localhost', + 389, + 'ou=users,dc=yunohost,dc=org', + 'uid', + 'givenName', + 'sn', + 'mail', + TRUE, + '(&(objectclass=posixAccount)(permission=cn=redmine.main,ou=permission,dc=yunohost,dc=org))' +) \ No newline at end of file diff --git a/scripts/install b/scripts/install index ca5b6b5..3d69e6d 100644 --- a/scripts/install +++ b/scripts/install @@ -54,6 +54,8 @@ ynh_add_config --template="../conf/configuration.yml.example" --destination="$in chmod 400 "$install_dir/config/configuration.yml" chown $app:$app "$install_dir/config/configuration.yml" +ynh_add_config --template="db-ldap.sql" --destination="$install_dir/config/db-ldap.sql" + #================================================= # BUILD APP #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c4c175e..ac9ca43 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." --weight=1 upgrade_type=$(ynh_check_app_version_changed) @@ -76,6 +75,10 @@ pushd $install_dir ynh_exec_warn_less bundle exec rake db:migrate RAILS_ENV=production popd +#Setting up LDAP authentification +ynh_psql_connect_as $db_user $db_pwd $db_name < $install_dir/config/db-ldap.sql +rm -f $install_dir/config/db-ldap.sql + chmod 750 "$install_dir/public" chmod -R o-rwx "$install_dir/public" chown -R $app:www-data "$install_dir/public"