On essaie de pas péter la compatibilité pour la création de home des clubs.
This commit is contained in:
parent
0c4a999b1f
commit
1b68e5f5fd
1 changed files with 11 additions and 5 deletions
|
@ -117,7 +117,13 @@ class home:
|
||||||
try:
|
try:
|
||||||
login, oldLogin, oldHome = args.split(",")
|
login, oldLogin, oldHome = args.split(",")
|
||||||
if login:
|
if login:
|
||||||
adh = CONN.search("login=%s" % (login,))['adherent'][0]
|
res = CONN.search("login=%s" % (login,))
|
||||||
|
if res['adherent']:
|
||||||
|
adh = res['adherent'][0]
|
||||||
|
gid = config.gid
|
||||||
|
elif res['club']:
|
||||||
|
adh = res['club'][0]
|
||||||
|
gid = config.club_gid
|
||||||
home = adh.home()
|
home = adh.home()
|
||||||
uid = adh.uidNumber()
|
uid = adh.uidNumber()
|
||||||
mail_redirect = adh.email_exterieur()
|
mail_redirect = adh.email_exterieur()
|
||||||
|
@ -130,7 +136,7 @@ class home:
|
||||||
if not os.path.exists(home):
|
if not os.path.exists(home):
|
||||||
# Le home n'existe pas
|
# Le home n'existe pas
|
||||||
os.mkdir(home, 0755)
|
os.mkdir(home, 0755)
|
||||||
os.chown(home, int(uid), config.gid)
|
os.chown(home, int(uid), gid)
|
||||||
if homesplit[-2] != "club":
|
if homesplit[-2] != "club":
|
||||||
if os.path.exists(symlink) and os.path.islink(symlink):
|
if os.path.exists(symlink) and os.path.islink(symlink):
|
||||||
os.unlink(symlink)
|
os.unlink(symlink)
|
||||||
|
@ -141,7 +147,7 @@ class home:
|
||||||
# Il y un répertoire existant
|
# Il y un répertoire existant
|
||||||
# Bon UID ?
|
# Bon UID ?
|
||||||
stat = os.stat(home)
|
stat = os.stat(home)
|
||||||
if stat[4] != int(uid) or stat[5] != config.gid:
|
if stat[4] != int(uid) or stat[5] != gid:
|
||||||
# Le home n'est pas pas à la bonne personne
|
# Le home n'est pas pas à la bonne personne
|
||||||
raise OSError('home existant')
|
raise OSError('home existant')
|
||||||
if homesplit[-2] != "club":
|
if homesplit[-2] != "club":
|
||||||
|
@ -163,7 +169,7 @@ class home:
|
||||||
### Mail
|
### Mail
|
||||||
if not os.path.exists(home + '/Mail'):
|
if not os.path.exists(home + '/Mail'):
|
||||||
os.mkdir(home + '/Mail', 0700)
|
os.mkdir(home + '/Mail', 0700)
|
||||||
os.chown(home + '/Mail', int(uid), config.gid)
|
os.chown(home + '/Mail', int(uid), gid)
|
||||||
if not os.path.exists('/home-adh/mail/' + login):
|
if not os.path.exists('/home-adh/mail/' + login):
|
||||||
os.mkdir('/home-adh/mail/' + login, 0700)
|
os.mkdir('/home-adh/mail/' + login, 0700)
|
||||||
os.chown('/home-adh/mail/' + login, int(uid), 8)
|
os.chown('/home-adh/mail/' + login, int(uid), 8)
|
||||||
|
@ -171,7 +177,7 @@ class home:
|
||||||
### Redirection
|
### Redirection
|
||||||
if mail_redirect:
|
if mail_redirect:
|
||||||
file(home + '/.forward', 'w').write(mail_redirect + '\n')
|
file(home + '/.forward', 'w').write(mail_redirect + '\n')
|
||||||
os.chown(home + '/.forward', int(uid), config.gid)
|
os.chown(home + '/.forward', int(uid), gid)
|
||||||
os.chmod(home + '/.forward', 0604)
|
os.chmod(home + '/.forward', 0604)
|
||||||
### Owncloud dans le home
|
### Owncloud dans le home
|
||||||
if not os.path.exists(home + '/OwnCloud'):
|
if not os.path.exists(home + '/OwnCloud'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue