|
|
@ -35,7 +35,7 @@ class UserAd: |
|
|
|
expression = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=%s))" % self.usrName |
|
|
|
res = self.sam.search(base=base, expression=expression, attrs=['memberOf']) |
|
|
|
groups = [] |
|
|
|
if len(res[0]) == 0: |
|
|
|
if len(res) == 0 or len(res[0]) == 0: |
|
|
|
return groups |
|
|
|
for k in res[0]['memberOf']: |
|
|
|
groups.append(str(k).split(',')[0].split('=')[1]) |
|
|
|