Browse Source

мелкие изменения, тестирую.

master
Mikhail Grebenkin 6 years ago
parent
commit
bc0b254915
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      UserAd_class.py

+ 1
- 1
UserAd_class.py View File

@ -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])


Loading…
Cancel
Save

Powered by TurnKey Linux.