From 6aab0251e96577e38fa302b1732633f4fb46b716 Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 7 Oct 2020 02:37:16 +0200 Subject: [PATCH] [enh] LDAP permission support --- scripts/install | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 4567358..2f6176a 100644 --- a/scripts/install +++ b/scripts/install @@ -233,7 +233,9 @@ ynh_script_progression --message="Configuring LDAP authentication..." --weight=1 sudo -u $app env PATH=$PATH drush @$app pm-download ldap sudo -u $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role # Generated with sudo -u postgres pg_dump -a -t ldap_servers --inserts framaforms -sudo -u $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_servers VALUES ('localhost', 1, 'localhost', 1, 'default', 'ldap://127.0.0.1', 389, 0, 0, 3, '', NULL, 'a:2:{i:0;s:27:\"ou=users,dc=yunohost,dc=org\";i:1;s:28:\"ou=groups,dc=yunohost,dc=org\";}', 'uid', 'uid', 'mail', '', '', '', 0, 'cn=%username,ou=users,dc=yunohost,dc=org', '', 'ljf', '', 0, 'groupofnamesynh', 0, 0, '', 'memberuid', 'dn', 0, '', 'all_users', '', 0, 1000, 0);" +sudo -u $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_servers VALUES ('localhost', 1, 'localhost', 1, 'default', 'ldap://127.0.0.1', 389, 0, 0, 3, '', NULL, 'a:2:{i:0;s:27:\"ou=users,dc=yunohost,dc=org\";i:1;s:32:\"ou=permission,dc=yunohost,dc=org\";}', 'uid', 'uid', 'mail', '', '', '', 0, 'cn=%username,ou=users,dc=yunohost,dc=org', '', '', '', 0, 'permissionynh', 0, 1, 'permission', 'memberuid', 'dn', 0, '', '$app.main', '', 0, 1000, 0);" +sudo -u $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_authorization VALUES (1, 'localhost', 'drupal_role', 'ldap_authorization_drupal_role', 1, 1, 0, 'a:2:{i:0;a:6:{s:12:\"user_entered\";s:24:\"utilisateur authentifié\";s:4:\"from\";s:51:\"cn=framaforms.main,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:24:\"utilisateur authentifié\";s:10:\"simplified\";s:24:\"utilisateur authentifié\";s:5:\"valid\";b:0;s:13:\"error_message\";s:112:\"Role utilisateur authentifié_name does not exist and role creation is not enabled.\";}i:1;a:6:{s:12:\"user_entered\";s:13:\"administrator\";s:4:\"from\";s:52:\"cn=framaforms.admin,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:13:\"administrator\";s:10:\"simplified\";s:13:\"administrator\";s:5:\"valid\";b:0;s:13:\"error_message\";s:101:\"Role administrator_name does not exist and role creation is not enabled.\";}}', 1, 0, 1, 1, 1, 1);" + cat ../conf/ldap.conf | sudo -u $app env PATH=$PATH drush @$app variable-set --format=yaml ldap_authentication_conf - update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} @@ -271,6 +273,8 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=1 +ynh_permission_create --permission "admin" --url /admin/ + # Make app public if necessary if [ $is_public -eq 1 ] then