mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Properly reload SSOwat configuration at user modification
This commit is contained in:
parent
fcd5b4d3c6
commit
2b7881a44a
1 changed files with 8 additions and 3 deletions
9
user.py
9
user.py
|
@ -98,6 +98,7 @@ def user_create(auth, username, firstname, lastname, mail, password):
|
||||||
"""
|
"""
|
||||||
from yunohost.domain import domain_list
|
from yunohost.domain import domain_list
|
||||||
from yunohost.hook import hook_callback
|
from yunohost.hook import hook_callback
|
||||||
|
from yunohost.app import app_ssowatconf
|
||||||
|
|
||||||
# Validate password length
|
# Validate password length
|
||||||
if len(password) < 4:
|
if len(password) < 4:
|
||||||
|
@ -175,7 +176,7 @@ def user_create(auth, username, firstname, lastname, mail, password):
|
||||||
memberlist.append(username)
|
memberlist.append(username)
|
||||||
if auth.update('cn=sftpusers,ou=groups', { 'memberUid': memberlist }):
|
if auth.update('cn=sftpusers,ou=groups', { 'memberUid': memberlist }):
|
||||||
os.system("su - %s -c ''" % username)
|
os.system("su - %s -c ''" % username)
|
||||||
os.system('yunohost app ssowatconf > /dev/null 2>&1')
|
app_ssowatconf(auth)
|
||||||
#TODO: Send a welcome mail to user
|
#TODO: Send a welcome mail to user
|
||||||
msignals.display(m18n.n('user_created'), 'success')
|
msignals.display(m18n.n('user_created'), 'success')
|
||||||
hook_callback('post_user_create', [username, mail, password, firstname, lastname])
|
hook_callback('post_user_create', [username, mail, password, firstname, lastname])
|
||||||
|
@ -194,6 +195,8 @@ def user_delete(auth, users, purge=False):
|
||||||
purge
|
purge
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from yunohost.app import app_ssowatconf
|
||||||
|
|
||||||
if not isinstance(users, list):
|
if not isinstance(users, list):
|
||||||
users = [ users ]
|
users = [ users ]
|
||||||
deleted = []
|
deleted = []
|
||||||
|
@ -212,7 +215,7 @@ def user_delete(auth, users, purge=False):
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(169, m18n.n('user_deletion_failed'))
|
raise MoulinetteError(169, m18n.n('user_deletion_failed'))
|
||||||
|
|
||||||
os.system('yunohost app ssowatconf > /dev/null 2>&1')
|
app_ssowatconf(auth)
|
||||||
msignals.display(m18n.n('user_deleted'), 'success')
|
msignals.display(m18n.n('user_deleted'), 'success')
|
||||||
return { 'users': deleted }
|
return { 'users': deleted }
|
||||||
|
|
||||||
|
@ -234,6 +237,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None, change
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.domain import domain_list
|
from yunohost.domain import domain_list
|
||||||
|
from yunohost.app import app_ssowatconf
|
||||||
|
|
||||||
attrs_to_fetch = ['givenName', 'sn', 'mail', 'maildrop']
|
attrs_to_fetch = ['givenName', 'sn', 'mail', 'maildrop']
|
||||||
new_attr_dict = {}
|
new_attr_dict = {}
|
||||||
|
@ -317,6 +321,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None, change
|
||||||
|
|
||||||
if auth.update('uid=%s,ou=users' % username, new_attr_dict):
|
if auth.update('uid=%s,ou=users' % username, new_attr_dict):
|
||||||
msignals.display(m18n.n('user_updated'), 'success')
|
msignals.display(m18n.n('user_updated'), 'success')
|
||||||
|
app_ssowatconf(auth)
|
||||||
return user_info(auth, username)
|
return user_info(auth, username)
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(169, m18n.n('user_update_failed'))
|
raise MoulinetteError(169, m18n.n('user_update_failed'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue