parent
246cba6107
commit
b552af7739
1 changed files with 14 additions and 19 deletions
|
@ -1,19 +1,20 @@
|
||||||
#!/bin/bash /usr/scripts/python.sh
|
#! /usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (C) Frédéric Pauget
|
# Copyright (C) Frédéric Pauget
|
||||||
# Licence : GPLv2
|
# Licence : GPLv2
|
||||||
|
|
||||||
import smtplib, socket, sys, commands, shutil, os, traceback,grp
|
import smtplib, sys, commands, shutil, os, traceback,grp
|
||||||
from time import strftime
|
from time import strftime
|
||||||
|
|
||||||
|
sys.path.append('/usr/scripts/gestion')
|
||||||
|
if '/usr/scripts' not in sys.path:
|
||||||
|
sys.path.append('/usr/scripts')
|
||||||
from gestion.affich_tools import cprint, anim, OK, WARNING, ERREUR
|
from gestion.affich_tools import cprint, anim, OK, WARNING, ERREUR
|
||||||
import gestion.config as config
|
import gestion.config as config
|
||||||
import config.mails as config_mails
|
import config.mails as config_mails
|
||||||
import gestion.mail as mail_module
|
import gestion.mail as mail_module
|
||||||
|
from gestion.ldap_crans import hostname, crans_ldap
|
||||||
from lc_ldap import shortcuts
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sys.path.append('/usr/lib/mailman')
|
sys.path.append('/usr/lib/mailman')
|
||||||
|
@ -24,12 +25,7 @@ except:
|
||||||
# Machine sans mailman, les ML ne seront pas reconfigurées
|
# Machine sans mailman, les ML ne seront pas reconfigurées
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Connexion lc_ldap ro
|
CONN = crans_ldap()
|
||||||
|
|
||||||
ldap = shortcuts.lc_ldap_readonly()
|
|
||||||
|
|
||||||
# Hostname
|
|
||||||
hostname = socket.gethostname()
|
|
||||||
|
|
||||||
class del_user:
|
class del_user:
|
||||||
""" Suppression des fichiers d'un compte utilisateur """
|
""" Suppression des fichiers d'un compte utilisateur """
|
||||||
|
@ -121,17 +117,16 @@ class home:
|
||||||
try:
|
try:
|
||||||
login, oldLogin, oldHome = args.split(",")
|
login, oldLogin, oldHome = args.split(",")
|
||||||
if login:
|
if login:
|
||||||
res = ldap.search(u"uid=%s" % (login,))[0]
|
res = CONN.search("login=%s" % (login,))
|
||||||
if res.ldap_name == u'adherent':
|
if res['adherent']:
|
||||||
adh = res
|
adh = res['adherent'][0]
|
||||||
gid = config.gid
|
gid = config.gid
|
||||||
elif res['club']:
|
elif res['club']:
|
||||||
adh = res
|
adh = res['club'][0]
|
||||||
gid = config.club_gid
|
gid = config.club_gid
|
||||||
home = unicode(adh['homeDirectory'][0])
|
home = adh.home()
|
||||||
uid = int(adh['uidNumber'][0])
|
uid = adh.uidNumber()
|
||||||
if adh['mailExt'] != []:
|
mail_redirect = adh.email_exterieur()
|
||||||
mail_redirect = unicode(adh['mailExt'][0])
|
|
||||||
if oldHome and hostname == "zbee":
|
if oldHome and hostname == "zbee":
|
||||||
home_service = del_user(["%s,%s" % (oldLogin, oldHome)])
|
home_service = del_user(["%s,%s" % (oldLogin, oldHome)])
|
||||||
home_service.delete_zbee()
|
home_service.delete_zbee()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue