mirror of
https://github.com/YunoHost-Apps/humhub_ynh.git
synced 2024-09-03 19:26:11 +02:00
commit
50c74393ad
3 changed files with 33 additions and 52 deletions
|
@ -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;
|
|
@ -12,7 +12,7 @@
|
|||
"name": "Nils Van Zuijlen",
|
||||
"url": "https://github.com/nils-van-zuijlen"
|
||||
},
|
||||
"version": "1.8.2~ynh2",
|
||||
"version": "1.8.2~ynh3",
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
},
|
||||
|
|
|
@ -136,35 +136,44 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# Installation with curl
|
||||
ynh_script_progression --message="Finalizing installation..." --weight=2
|
||||
|
||||
admin_temp_pass=$(ynh_string_random 6)
|
||||
admin_email=$(ynh_user_get_info "$admin" mail)
|
||||
admin_firstname=$(ynh_user_get_info "$admin" firstname)
|
||||
admin_lastname=$(ynh_user_get_info "$admin" lastname)
|
||||
pushd $final_path/protected
|
||||
php${YNH_PHP_VERSION} yii migrate/up --includeModuleMigrations=1 --interactive=0
|
||||
|
||||
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"
|
||||
|
||||
local_curl_csrf "/index.php?r=installer/config/use-case" \
|
||||
local_curl_csrf "/index.php?r=installer/config/use-case" \
|
||||
"UseCaseForm[useCase]=" \
|
||||
"UseCaseForm[useCase]=other"
|
||||
|
||||
local_curl_csrf "/index.php?r=installer/config/admin" \
|
||||
`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" \
|
||||
local_curl_csrf "/index.php?r=installer/config/sample-data" \
|
||||
"SampleDataForm[sampleData]=0"
|
||||
|
||||
# Populate the LDAP parameters
|
||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/ldap.sql"
|
||||
mysql -u $db_user -p${db_pwd} $db_name < ../conf/ldap.sql
|
||||
php${YNH_PHP_VERSION} yii settings/set user auth.anonymousRegistration '0'
|
||||
php${YNH_PHP_VERSION} yii settings/set user auth.allowGuestAccess '0'
|
||||
php${YNH_PHP_VERSION} yii settings/set user auth.internalUsersCanInvite '0'
|
||||
|
||||
popd
|
||||
|
||||
# Remove the public access
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
|
Loading…
Reference in a new issue