-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
executable file
·49 lines (39 loc) · 1.01 KB
/
Copy path__init__.py
File metadata and controls
executable file
·49 lines (39 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
"""Mldap2 is a custom AD/LDAP wrapper built using python-ldap. It is
used to simplify programmatic access to the users and groups in a
Windows Server 2003, Windows Server 2008, and Windows Server 2012
Active Directory(tm) Domain.
"""
__version__ = "2.0.5"
__author__ = "Shaun Meyer"
__date__ = "June, 2009"
import os
import sys
import warnings
import datetime
from uac import uac
from aduser import ADuser
from adgroup import ADgroup
from adcon import mldap
# Enable all warnings
warnings.simplefilter('default')
class NoSuchObject(Exception):
""" Provide a custom exception to call when we have no user to
perform an action upon. """
pass
def connect(creds):
"""
Args:
creds(dict) having these keys:
* credsfile
* LDAP_USERNAME
* LDAP_PASSWORD
* LDAP_SERVER
* LDAP_BASE
* LDAP_USER_BASE
* LDAP_GROUP_BASE
* LDAP_DOMAIN
:returns:
A connected :class:`adcon.mldap` object.
"""
return mldap(**creds)