1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/question2answer_ynh.git synced 2024-09-03 20:16:07 +02:00
question2answer_ynh/conf/ldap.sql
Nils VAN ZUIJLEN 1622f13c13 Use SQL to configure the LDAP plugin
cURL is too complicated, and we already have to use SQL to update the user

Also remove the need to ask for a password
2021-03-26 18:22:57 +01:00

32 lines
1 KiB
PL/PgSQL

BEGIN;
DELETE FROM `qa_options` WHERE `title` IN (
'ldap_authentication_attribute',
'ldap_login_ad',
'ldap_login_allow_normal',
'ldap_login_filter',
'ldap_login_fname',
'ldap_login_generic_search',
'ldap_login_hostname',
'ldap_login_mail',
'ldap_login_port',
'ldap_login_sname'
);
INSERT INTO `qa_options` (`title`, `content`) VALUES
('ldap_authentication_attribute', 'uid'),
('ldap_login_ad', ''),
('ldap_login_allow_normal', ''),
('ldap_login_filter', '(objectClass=mailAccount)'),
('ldap_login_fname', 'givenname'),
('ldap_login_generic_search', 'uid=USERNAME,ou=users,dc=yunohost,dc=org/mail=USERNAME,ou=users,dc=yunohost,dc=org'),
('ldap_login_hostname', 'ldap://localhost'),
('ldap_login_mail', 'mail'),
('ldap_login_port', '389'),
('ldap_login_sname', 'sn');
UPDATE `qa_users` SET `sessionsource` = 'ldap';
INSERT INTO `qa_userlogins` (`userid`, `source`, `identifier`, `identifiermd5`) VALUES
((SELECT userid FROM `qa_users` WHERE `handle` = '__ADMIN__'), 'ldap', '__ADMIN_EMAIL__', UNHEX(MD5('__ADMIN_EMAIL__')));
COMMIT;