Sercice home à jour.
This commit is contained in:
parent
54510faa56
commit
519293602b
1 changed files with 6 additions and 4 deletions
10
services.py
10
services.py
|
@ -79,7 +79,8 @@ def services_to_args_dns(x):
|
|||
return []
|
||||
|
||||
# Trouver comment faire le cas où on ajoute une redirection mail (il faut alors retourner un quadruplet "homedir,uidNumber,uid,mail")
|
||||
def services_to_args_home(x):
|
||||
def services_to_args_home(old, new):
|
||||
x = new['objectclass'][0]
|
||||
if isinstance(x, attributs.Attr):
|
||||
proprio=x.parent
|
||||
elif isinstance(x, objets.proprio):
|
||||
|
@ -87,7 +88,7 @@ def services_to_args_home(x):
|
|||
else:
|
||||
return []
|
||||
if u'cransAccount' in [ str(o) for o in proprio['objectClass']]:
|
||||
return [ "%s,%s,%s" % (proprio['homeDirectory'][0],proprio['uidNumber'][0],proprio['uid'][0]) ]
|
||||
return [ "%s,%s,%s" % (proprio['uid'][0], old.get('uid', [''])[0], old.get('homeDirectory', [''])[0]) ]
|
||||
else:
|
||||
return []
|
||||
|
||||
|
@ -315,12 +316,13 @@ def services_to_restart(conn, old_attrs={}, new_attrs={}, created_object=[], del
|
|||
update_now()
|
||||
|
||||
added_objectClass = [obc for obc in new_attrs.get("objectClass", []) if not obc in old_attrs.get("objectClass", [])]
|
||||
updated_objectClass = [obc for obc in new_attrs.get("objectClass", []) if obc in old_attrs.get("objectClass", [])]
|
||||
deleted_objectClass = [obc for obc in old_attrs.get("objectClass", []) if not obc in new_attrs.get("objectClass", [])]
|
||||
|
||||
# Je met la reconfiguration du home / del_user à la main pour la création/suppression d'un compte crans
|
||||
# parce que que je vois pas vraiement comment faire autrement
|
||||
if 'cransAccount' in added_objectClass:
|
||||
arg = services_to_args['home'](added_objectClass[0])
|
||||
if 'cransAccount' in added_objectClass + updated_objectClass:
|
||||
arg = services_to_args['home'](old_attrs, new_attrs)
|
||||
service_to_restart(conn, "home", list(arg), 0)
|
||||
|
||||
if 'cransAccount' in deleted_objectClass:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue