mirror of
https://github.com/YunoHost-Apps/libreerp_ynh.git
synced 2024-09-03 19:36:13 +02:00
[enh] Configure ldap
This commit is contained in:
parent
4dc5143fe1
commit
0666dd6cca
2 changed files with 38 additions and 9 deletions
File diff suppressed because one or more lines are too long
|
@ -10,6 +10,7 @@ version=$YNH_APP_ARG_VERSION
|
||||||
oca=$YNH_APP_ARG_OCA
|
oca=$YNH_APP_ARG_OCA
|
||||||
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
||||||
lang=$YNH_APP_ARG_LANG
|
lang=$YNH_APP_ARG_LANG
|
||||||
|
tz=$YNH_APP_ARG_TZ
|
||||||
|
|
||||||
# Load common variables
|
# Load common variables
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
@ -31,6 +32,7 @@ dbpass=$(ynh_string_random | sed "s/\[/e/g" | sed "s/\]/e/g")
|
||||||
|
|
||||||
ynh_app_setting_set "$app" domain "$domain"
|
ynh_app_setting_set "$app" domain "$domain"
|
||||||
ynh_app_setting_set "$app" lang "$lang"
|
ynh_app_setting_set "$app" lang "$lang"
|
||||||
|
ynh_app_setting_set "$app" tz "$tz"
|
||||||
ynh_app_setting_set "$app" psqlpwd "$dbpass"
|
ynh_app_setting_set "$app" psqlpwd "$dbpass"
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ else
|
||||||
# Install Odoo
|
# Install Odoo
|
||||||
sudo curl -sS https://nightly.odoo.com/odoo.key | sudo apt-key add -
|
sudo curl -sS https://nightly.odoo.com/odoo.key | sudo apt-key add -
|
||||||
sudo sh -c "echo 'deb http://nightly.odoo.com/${version}/nightly/deb/ ./' > /etc/apt/sources.list.d/odoo.list"
|
sudo sh -c "echo 'deb http://nightly.odoo.com/${version}/nightly/deb/ ./' > /etc/apt/sources.list.d/odoo.list"
|
||||||
|
# TODO if 8.0 install https://www.odoo.com/apps/modules/8.0/shell/
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
# Initialize installation
|
# Initialize installation
|
||||||
|
@ -115,12 +118,29 @@ sudo service postgresql reload
|
||||||
|
|
||||||
# Setup database: not working
|
# Setup database: not working
|
||||||
database=${domain//./-}
|
database=${domain//./-}
|
||||||
sudo /usr/bin/openerp-server -c /etc/odoo/openerp-server.conf --stop-after-init -d $database
|
sudo /usr/bin/openerp-server -c /etc/odoo/openerp-server.conf --stop-after-init -d $database --load-language $lang
|
||||||
#ynh_psql_create_db $database
|
sudo /usr/bin/openerp-server -c /etc/odoo/openerp-server.conf shell <<< \
|
||||||
#sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/install_database.py
|
"
|
||||||
#sudo sed -i "s@DOMAIN_DATABASE@${domain//./-}@g" ../conf/install_database.py
|
self.change_password('admin','$admin_password')
|
||||||
#sudo sed -i "s@DATABASE_LANG@$lang@g" ../conf/install_database.py
|
self.write({'tz':'$tz','lang':'$lang'})
|
||||||
#sudo sed -i "s@DATABASE_PASSWORD@$dbpass@g" ../conf/install_database.py
|
template=env['res.users'].create({
|
||||||
#sudo python ../conf/install_database.py
|
'login':'template',
|
||||||
|
'password':'',
|
||||||
|
'name':'template',
|
||||||
|
'email':'template',
|
||||||
|
'sel_groups_9_10':9,
|
||||||
|
'tz':'$tz',
|
||||||
|
'lang':'$lang'
|
||||||
|
})
|
||||||
|
self.company_id.ldaps.create({
|
||||||
|
'ldap_server':'localhost',
|
||||||
|
'ldap_server_port':389,
|
||||||
|
'ldap_base':'ou=users, dc=yunohost,dc=org',
|
||||||
|
'ldap_filter':'uid=%s',
|
||||||
|
'user':template.id,
|
||||||
|
'company':self.company_id.id
|
||||||
|
})
|
||||||
|
self.env.cr.commit()
|
||||||
|
"
|
||||||
|
|
||||||
sudo service odoo restart
|
sudo service odoo restart
|
||||||
# Setup LDAP: TO BE DONE
|
|
||||||
|
|
Loading…
Reference in a new issue