Move _get_all_groups up to the top

This commit is contained in:
twangboy 2017-10-23 15:25:13 -06:00
parent 7a3ff9387d
commit b0caec320e
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

View file

@ -48,6 +48,15 @@ def _get_group_object(name):
return nt.GetObject('', 'WinNT://./' + name + ',group')
def _get_all_groups():
pythoncom.CoInitialize()
nt = win32com.client.Dispatch('AdsNameSpaces')
results = nt.GetObject('', 'WinNT://.')
results.Filter = ['group']
return results
def _get_username(member):
'''
Resolve the username from the member object returned from a group query
@ -427,15 +436,6 @@ def members(name, members_list, **kwargs):
return ret
def _get_all_groups():
pythoncom.CoInitialize()
nt = win32com.client.Dispatch('AdsNameSpaces')
results = nt.GetObject('', 'WinNT://.')
results.Filter = ['group']
return results
def list_groups(refresh=False):
'''
Return a list of groups