Projet

Général

Profil

majgrouplinks.py

Joël Cuissinat, 18/09/2020 16:12

Télécharger (522 octets)

 
1
#!/usr/bin/python
2
# -*- coding: UTF-8 -*-
3

    
4
from os import listdir
5
from os.path import isdir, join
6
from string import ascii_letters
7
from scribe.linker import _user_factory
8

    
9
for lettre in ascii_letters:
10
    rep = join('/home', lettre)
11
    if not isdir(rep): continue
12
    users = listdir(rep)
13
    for user in users:
14
        print('Traitement de {}'.format(user))
15
        try:
16
            ldap_user = _user_factory(user.strip())
17
        except Exception as msg:
18
            print(msg)
19
        ldap_user._gen_groupesdir(user)
20