1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/humhub_ynh.git synced 2024-09-03 19:26:11 +02:00

Merge pull request #28 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2021-11-29 17:56:19 +01:00 committed by GitHub
commit 50c74393ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 52 deletions

View file

@ -1,28 +0,0 @@
BEGIN;
DELETE FROM setting WHERE
(`name` = 'auth.anonymousRegistration') OR
(`name` = 'auth.allowGuestAccess') OR
(`name` = 'auth.internalUsersCanInvite');
INSERT INTO setting (`name`, `value`, `module_id`) VALUES
('enabled', '1', 'ldap'),
('hostname', 'localhost', 'ldap'),
('port', '389', 'ldap'),
('encryption', '', 'ldap'),
('username', '', 'ldap'),
('password', '', 'ldap'),
('baseDn', 'ou=users,dc=yunohost,dc=org', 'ldap'),
('loginFilter', '(uid=%s)', 'ldap'),
('userFilter', 'objectClass=mailAccount', 'ldap'),
('emailAttribute', 'mail', 'ldap'),
('usernameAttribute', 'uid', 'ldap'),
('idAttribute', 'uid', 'ldap'),
('refreshUsers', '1', 'ldap'),
('auth.anonymousRegistration', '0', 'user'),
('auth.allowGuestAccess', '0', 'user'),
('auth.internalUsersCanInvite', '0', 'user');
UPDATE `user` SET `auth_mode` = 'ldap' WHERE `user`.`username` = '__ADMIN__';
COMMIT;

View file

@ -12,7 +12,7 @@
"name": "Nils Van Zuijlen", "name": "Nils Van Zuijlen",
"url": "https://github.com/nils-van-zuijlen" "url": "https://github.com/nils-van-zuijlen"
}, },
"version": "1.8.2~ynh2", "version": "1.8.2~ynh3",
"requirements": { "requirements": {
"yunohost": ">= 4.1.7" "yunohost": ">= 4.1.7"
}, },

View file

@ -136,35 +136,44 @@ ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl # Installation with curl
ynh_script_progression --message="Finalizing installation..." --weight=2 ynh_script_progression --message="Finalizing installation..." --weight=2
admin_temp_pass=$(ynh_string_random 6) pushd $final_path/protected
admin_email=$(ynh_user_get_info "$admin" mail) php${YNH_PHP_VERSION} yii migrate/up --includeModuleMigrations=1 --interactive=0
admin_firstname=$(ynh_user_get_info "$admin" firstname)
admin_lastname=$(ynh_user_get_info "$admin" lastname)
ynh_local_curl "/index.php?r=installer/index/go" php${YNH_PHP_VERSION} yii settings/set ldap enabled '1'
php${YNH_PHP_VERSION} yii settings/set ldap hostname 'localhost'
php${YNH_PHP_VERSION} yii settings/set ldap port 389
php${YNH_PHP_VERSION} yii settings/set ldap encryption ''
php${YNH_PHP_VERSION} yii settings/set ldap username ''
php${YNH_PHP_VERSION} yii settings/set ldap password ''
php${YNH_PHP_VERSION} yii settings/set ldap baseDn 'ou=users,dc=yunohost,dc=org'
php${YNH_PHP_VERSION} yii settings/set ldap loginFilter '(uid=%s)'
php${YNH_PHP_VERSION} yii settings/set ldap userFilter 'objectClass=mailAccount'
php${YNH_PHP_VERSION} yii settings/set ldap emailAttribute 'mail'
php${YNH_PHP_VERSION} yii settings/set ldap usernameAttribute 'uid'
php${YNH_PHP_VERSION} yii settings/set ldap idAttribute 'uid'
php${YNH_PHP_VERSION} yii settings/set ldap refreshUsers '1'
php${YNH_PHP_VERSION} yii settings/set ldap refreshUsers '1'
local_curl_csrf "/index.php?r=installer/config/basic" \ php${YNH_PHP_VERSION} yii ldap/sync
php${YNH_PHP_VERSION} yii user/make-admin ${admin}
ynh_local_curl "/index.php?r=installer/index/go"
local_curl_csrf "/index.php?r=installer/config/basic" \
"ConfigBasicForm[name]=YunoHost" "ConfigBasicForm[name]=YunoHost"
local_curl_csrf "/index.php?r=installer/config/use-case" \ local_curl_csrf "/index.php?r=installer/config/use-case" \
"UseCaseForm[useCase]=" \ "UseCaseForm[useCase]=" \
"UseCaseForm[useCase]=other" "UseCaseForm[useCase]=other"
local_curl_csrf "/index.php?r=installer/config/admin" \ local_curl_csrf "/index.php?r=installer/config/sample-data" \
`myynh_urlencode "User[username]=$admin"` \
`myynh_urlencode "User[email]=$admin_email"` \
`myynh_urlencode "Password[newPassword]=$admin_temp_pass"` \
`myynh_urlencode "Password[newPasswordConfirm]=$admin_temp_pass"` \
`myynh_urlencode "Profile[firstname]=${admin_firstname}"` \
`myynh_urlencode "Profile[lastname]=${admin_lastname}"` \
"save"
local_curl_csrf "/index.php?r=installer/config/sample-data" \
"SampleDataForm[sampleData]=0" "SampleDataForm[sampleData]=0"
# Populate the LDAP parameters php${YNH_PHP_VERSION} yii settings/set user auth.anonymousRegistration '0'
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/ldap.sql" php${YNH_PHP_VERSION} yii settings/set user auth.allowGuestAccess '0'
mysql -u $db_user -p${db_pwd} $db_name < ../conf/ldap.sql php${YNH_PHP_VERSION} yii settings/set user auth.internalUsersCanInvite '0'
popd
# Remove the public access # Remove the public access
ynh_permission_update --permission="main" --remove="visitors" ynh_permission_update --permission="main" --remove="visitors"