1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/framaforms_ynh.git synced 2024-09-03 18:36:12 +02:00

Split sql strings to a config file for ldap

This commit is contained in:
Salamandar 2024-03-18 13:44:22 +01:00
parent fbd530bc84
commit 5d8cab2b8e
2 changed files with 14 additions and 3 deletions

13
conf/ldap.sql Normal file
View file

@ -0,0 +1,13 @@
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
);
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 <em class=\"placeholder\">utilisateur authentifié</em>_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 <em class=\"placeholder\">administrator</em>_name does not exist and role creation is not enabled.\";}}',
1, 0, 1, 1, 1, 1
);

View file

@ -124,9 +124,7 @@ ynh_script_progression --message="Configuring LDAP authentication..." --weight=1
_ynh_exec_with_drush_php drush "@$app" pm-download ldap-7.x-2.6 _ynh_exec_with_drush_php drush "@$app" pm-download ldap-7.x-2.6
_ynh_exec_with_drush_php drush "@$app" pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role _ynh_exec_with_drush_php 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 # Generated with sudo -u postgres pg_dump -a -t ldap_servers --inserts framaforms
_ynh_exec_with_drush_php 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);" _ynh_exec_with_drush_php drush "@$app" sql-query < ../conf/ldap.sql
_ynh_exec_with_drush_php 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 <em class=\"placeholder\">utilisateur authentifié</em>_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 <em class=\"placeholder\">administrator</em>_name does not exist and role creation is not enabled.\";}}', 1, 0, 1, 1, 1, 1);"
_ynh_exec_with_drush_php drush "@$app" variable-set --format=yaml ldap_authentication_conf - < ../conf/ldap.conf _ynh_exec_with_drush_php drush "@$app" variable-set --format=yaml ldap_authentication_conf - < ../conf/ldap.conf
#================================================= #=================================================