csh-ldap 2.4.0.dev4__tar.gz → 2.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/.github/workflows/python.yaml +1 -1
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/.pylintrc +13 -17
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/AUTHORS +3 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/ChangeLog +23 -0
- csh_ldap-2.5.2/PKG-INFO +86 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap/__init__.py +7 -12
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap/group.py +6 -7
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap/member.py +6 -8
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap/utility.py +5 -2
- csh_ldap-2.5.2/csh_ldap.egg-info/PKG-INFO +86 -0
- csh_ldap-2.5.2/csh_ldap.egg-info/pbr.json +1 -0
- csh_ldap-2.5.2/csh_ldap.egg-info/requires.txt +2 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/requirements-test.txt +1 -1
- csh_ldap-2.5.2/requirements.txt +2 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/setup.cfg +3 -3
- csh_ldap-2.4.0.dev4/PKG-INFO +0 -15
- csh_ldap-2.4.0.dev4/csh_ldap.egg-info/PKG-INFO +0 -15
- csh_ldap-2.4.0.dev4/csh_ldap.egg-info/pbr.json +0 -1
- csh_ldap-2.4.0.dev4/csh_ldap.egg-info/requires.txt +0 -2
- csh_ldap-2.4.0.dev4/requirements.txt +0 -2
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/LICENSE +0 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/README.md +0 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap.egg-info/SOURCES.txt +0 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap.egg-info/dependency_links.txt +0 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap.egg-info/not-zip-safe +0 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/csh_ldap.egg-info/top_level.txt +0 -0
- {csh_ldap-2.4.0.dev4 → csh_ldap-2.5.2}/setup.py +0 -0
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
strategy:
|
|
13
13
|
matrix:
|
|
14
|
-
python-version: [3.
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
15
|
steps:
|
|
16
16
|
- name: Install ldap dependencies
|
|
17
17
|
run: sudo apt-get update && sudo apt-get install libldap2-dev libsasl2-dev
|
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
[MASTER]
|
|
2
|
-
ignore
|
|
2
|
+
ignore-paths=input
|
|
3
3
|
persistent = yes
|
|
4
4
|
|
|
5
5
|
[MESSAGES CONTROL]
|
|
6
6
|
disable =
|
|
7
7
|
missing-docstring,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
file-ignored,
|
|
8
|
+
fixme,
|
|
9
|
+
duplicate-code,
|
|
10
|
+
no-member,
|
|
11
|
+
parse-error,
|
|
12
|
+
too-few-public-methods,
|
|
13
|
+
global-statement,
|
|
14
|
+
cyclic-import,
|
|
15
|
+
locally-disabled,
|
|
16
|
+
file-ignored,
|
|
18
17
|
import-error,
|
|
19
18
|
unused-import
|
|
20
19
|
|
|
21
20
|
[REPORTS]
|
|
22
21
|
output-format = text
|
|
23
|
-
files-output = no
|
|
24
22
|
reports = no
|
|
25
23
|
|
|
26
24
|
[FORMAT]
|
|
27
25
|
max-line-length = 120
|
|
28
|
-
max-statement-lines = 75
|
|
29
26
|
single-line-if-stmt = no
|
|
30
|
-
no-space-check = trailing-comma,dict-separator
|
|
31
27
|
max-module-lines = 1000
|
|
32
28
|
indent-string = ' '
|
|
33
29
|
|
|
@@ -75,8 +71,8 @@ good-names=logger,id,ID
|
|
|
75
71
|
# Bad variable names which should always be refused, separated by a comma
|
|
76
72
|
bad-names=foo,bar,baz,toto,tutu,tata
|
|
77
73
|
|
|
78
|
-
#
|
|
79
|
-
|
|
74
|
+
# Note: bad-functions option was removed in modern pylint versions
|
|
75
|
+
# Use specific pylint checks instead
|
|
80
76
|
|
|
81
77
|
|
|
82
78
|
[DESIGN]
|
|
@@ -92,4 +88,4 @@ min-public-methods = 2
|
|
|
92
88
|
max-public-methods = 20
|
|
93
89
|
|
|
94
90
|
[EXCEPTIONS]
|
|
95
|
-
overgeneral-exceptions = Exception
|
|
91
|
+
overgeneral-exceptions = builtins.Exception
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Adam Brewer <adamhb321@gmail.com>
|
|
2
|
+
Cole Stowell <121599022+costowell@users.noreply.github.com>
|
|
3
|
+
Cole Stowell <cole@stowell.pro>
|
|
2
4
|
Devin Matte <devinmatte@gmail.com>
|
|
3
5
|
Galen Guyer <galen@galenguyer.com>
|
|
4
6
|
Jordan Rodgers <com6056@gmail.com>
|
|
@@ -6,5 +8,6 @@ Liam Middlebrook <liammiddlebrook@gmail.com>
|
|
|
6
8
|
Marc Billow <mbillow@me.com>
|
|
7
9
|
Max Meinhold <mxmeinhold@gmail.com>
|
|
8
10
|
Michael Francis <mikefrancis95@gmail.com>
|
|
11
|
+
Tyler Allen <tyler@tallen.me>
|
|
9
12
|
William Stevens <contact@wastevensv.com>
|
|
10
13
|
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
CHANGES
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
+
2.5.2
|
|
5
|
+
-----
|
|
6
|
+
|
|
7
|
+
* bump: 2.5.2
|
|
8
|
+
* bump: srvlookup 2.0.0 -> 3.0.0, python-ldap 3.4.4 -> 3.4.5
|
|
9
|
+
|
|
10
|
+
2.5.1
|
|
11
|
+
-----
|
|
12
|
+
|
|
13
|
+
* bump: 2.5.1
|
|
14
|
+
* fix: \_get\_attr -> \_\_getattr\_\_
|
|
15
|
+
|
|
16
|
+
2.5.0
|
|
17
|
+
-----
|
|
18
|
+
|
|
19
|
+
* Bump to 2.5.0
|
|
20
|
+
* Bump python-ldap from 3.4.0 to 3.4.4
|
|
21
|
+
* fix: bump pylint and python version in CI
|
|
22
|
+
|
|
23
|
+
2.4.0
|
|
24
|
+
-----
|
|
25
|
+
|
|
26
|
+
* Bump to 2.4.0
|
|
4
27
|
* Bump python-ldap from 3.0.0 to 3.4.0
|
|
5
28
|
* swap from travis to github actions
|
|
6
29
|
|
csh_ldap-2.5.2/PKG-INFO
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: csh_ldap
|
|
3
|
+
Version: 2.5.2
|
|
4
|
+
Summary: CSH LDAP ORM
|
|
5
|
+
Home-page: https://github.com/ComputerScienceHouse/csh_ldap
|
|
6
|
+
Author: Liam Middlebrook
|
|
7
|
+
Author-email: liammiddlebrook@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Natural Language :: English
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: AUTHORS
|
|
14
|
+
Requires-Dist: python-ldap==3.4.5
|
|
15
|
+
Requires-Dist: srvlookup==3.0.0
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: license
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
# csh_ldap
|
|
25
|
+
|
|
26
|
+
[](https://badge.fury.io/py/csh_ldap)
|
|
27
|
+
[](https://travis-ci.org/liam-middlebrook/csh_ldap)
|
|
28
|
+
|
|
29
|
+
Python 3 ORM for CSH LDAP
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
`pip install csh_ldap`
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
import csh_ldap
|
|
41
|
+
|
|
42
|
+
# Create an unbatched instance
|
|
43
|
+
instance = csh_ldap.CSHLDAP(bind_dn, bind_pw)
|
|
44
|
+
|
|
45
|
+
# Create an batched instance
|
|
46
|
+
instance_batched = csh_ldap.CSHLDAP(bind_dn, bind_pw, batch_mods=True)
|
|
47
|
+
|
|
48
|
+
# Create a Read-Only instance that will only echo your changes
|
|
49
|
+
instance_ro = csh_ldap.CSHLDAP(bind_dn, bind_pw, ro=True)
|
|
50
|
+
|
|
51
|
+
# Get member by UUID
|
|
52
|
+
liam = instance.get_member(uuid_of_liam)
|
|
53
|
+
|
|
54
|
+
# Get member by UID
|
|
55
|
+
liam = instance.get_member(uid_of_liam, uid=True)
|
|
56
|
+
|
|
57
|
+
# Get member by iButton ID
|
|
58
|
+
liam = instance.get_member_ibutton(ibutton_id)
|
|
59
|
+
|
|
60
|
+
# Get member by Slack UID
|
|
61
|
+
liam = instance.get_member_slackuid(slack_uid)
|
|
62
|
+
|
|
63
|
+
# Get group by cn
|
|
64
|
+
rtp = instance.get_group('rtp')
|
|
65
|
+
|
|
66
|
+
# Get cn of member
|
|
67
|
+
print(liam.cn)
|
|
68
|
+
|
|
69
|
+
# Set cn of member
|
|
70
|
+
liam.cn = "Liam Middlebrook"
|
|
71
|
+
|
|
72
|
+
# Setting attributes to None removes them
|
|
73
|
+
liam.roomNumber = None
|
|
74
|
+
|
|
75
|
+
# Process batched writes per-dn
|
|
76
|
+
instance_batched.flush_mod()
|
|
77
|
+
|
|
78
|
+
# Get EBoard Directorship
|
|
79
|
+
# Directorships: ['chairman', 'evaluations', 'financial', 'history', 'imps', 'opcomm', 'research', 'social']
|
|
80
|
+
social = instance.get_directorship_heads('social')
|
|
81
|
+
|
|
82
|
+
for director in social:
|
|
83
|
+
# Directorships are always lists, since it can be multiple people.
|
|
84
|
+
print(director.cn)
|
|
85
|
+
|
|
86
|
+
```
|
|
@@ -11,7 +11,7 @@ class CSHLDAP:
|
|
|
11
11
|
__domain__ = "csh.rit.edu"
|
|
12
12
|
|
|
13
13
|
@reconnect_on_fail
|
|
14
|
-
def __init__(self, bind_dn, bind_pw, batch_mods=False,
|
|
14
|
+
def __init__(self, bind_dn, bind_pw, *, batch_mods=False,
|
|
15
15
|
sasl=False, ro=False):
|
|
16
16
|
"""Handler for bindings to CSH LDAP.
|
|
17
17
|
|
|
@@ -74,7 +74,7 @@ class CSHLDAP:
|
|
|
74
74
|
members = self.__con__.search_s(
|
|
75
75
|
CSHMember.__ldap_user_ou__,
|
|
76
76
|
ldap.SCOPE_SUBTREE,
|
|
77
|
-
"(ibutton
|
|
77
|
+
f"(ibutton={val})",
|
|
78
78
|
['ipaUniqueID'])
|
|
79
79
|
if members:
|
|
80
80
|
return CSHMember(
|
|
@@ -96,7 +96,7 @@ class CSHLDAP:
|
|
|
96
96
|
members = self.__con__.search_s(
|
|
97
97
|
CSHMember.__ldap_user_ou__,
|
|
98
98
|
ldap.SCOPE_SUBTREE,
|
|
99
|
-
"(slackuid
|
|
99
|
+
f"(slackuid={slack})",
|
|
100
100
|
['ipaUniqueID'])
|
|
101
101
|
if members:
|
|
102
102
|
return CSHMember(
|
|
@@ -132,7 +132,7 @@ class CSHLDAP:
|
|
|
132
132
|
res = self.__con__.search_s(
|
|
133
133
|
__ldap_group_ou__,
|
|
134
134
|
ldap.SCOPE_SUBTREE,
|
|
135
|
-
"(cn=eboard
|
|
135
|
+
f"(cn=eboard-{val})",
|
|
136
136
|
['member'])
|
|
137
137
|
|
|
138
138
|
ret = []
|
|
@@ -176,19 +176,14 @@ class CSHLDAP:
|
|
|
176
176
|
mod_str = "ADD"
|
|
177
177
|
else:
|
|
178
178
|
mod_str = "REPLACE"
|
|
179
|
-
print("{} VALUE {} = {} FOR {}"
|
|
180
|
-
mod[1],
|
|
181
|
-
mod[2],
|
|
182
|
-
dn))
|
|
179
|
+
print(f"{mod_str} VALUE {mod[1]} = {mod[2]} FOR {dn}")
|
|
183
180
|
else:
|
|
184
181
|
self.__con__.modify_s(dn, self.__mod_queue__[dn])
|
|
185
182
|
except ldap.TYPE_OR_VALUE_EXISTS:
|
|
186
|
-
print("Error! Conflicting Batch Modification:
|
|
187
|
-
% str(self.__mod_queue__[dn]))
|
|
183
|
+
print(f"Error! Conflicting Batch Modification: {self.__mod_queue__[dn]}")
|
|
188
184
|
continue
|
|
189
185
|
except ldap.NO_SUCH_ATTRIBUTE:
|
|
190
|
-
print("Error! Conflicting Batch Modification:
|
|
191
|
-
% str(self.__mod_queue__[dn]))
|
|
186
|
+
print(f"Error! Conflicting Batch Modification: {self.__mod_queue__[dn]}")
|
|
192
187
|
continue
|
|
193
188
|
self.__mod_queue__[dn] = None
|
|
194
189
|
self.__pending_mod_dn__ = []
|
|
@@ -21,7 +21,7 @@ class CSHGroup:
|
|
|
21
21
|
res = self.__con__.search_s(
|
|
22
22
|
self.__ldap_group_ou__,
|
|
23
23
|
ldap.SCOPE_SUBTREE,
|
|
24
|
-
"(cn
|
|
24
|
+
f"(cn={search_val})",
|
|
25
25
|
['cn'])
|
|
26
26
|
|
|
27
27
|
if res:
|
|
@@ -35,7 +35,7 @@ class CSHGroup:
|
|
|
35
35
|
res = self.__con__.search_s(
|
|
36
36
|
self.__ldap_base_dn__,
|
|
37
37
|
ldap.SCOPE_SUBTREE,
|
|
38
|
-
"(memberof
|
|
38
|
+
f"(memberof={self.__dn__})",
|
|
39
39
|
['uid'])
|
|
40
40
|
|
|
41
41
|
ret = []
|
|
@@ -69,13 +69,13 @@ class CSHGroup:
|
|
|
69
69
|
res = self.__con__.search_s(
|
|
70
70
|
self.__dn__,
|
|
71
71
|
ldap.SCOPE_BASE,
|
|
72
|
-
"(member
|
|
72
|
+
f"(member={dn})",
|
|
73
73
|
['ipaUniqueID'])
|
|
74
74
|
else:
|
|
75
75
|
res = self.__con__.search_s(
|
|
76
76
|
self.__dn__,
|
|
77
77
|
ldap.SCOPE_BASE,
|
|
78
|
-
"(member
|
|
78
|
+
f"(member={member.get_dn()})",
|
|
79
79
|
['ipaUniqueID'])
|
|
80
80
|
return len(res) > 0
|
|
81
81
|
|
|
@@ -105,7 +105,7 @@ class CSHGroup:
|
|
|
105
105
|
mod_attrs = [mod]
|
|
106
106
|
self.__con__.modify_s(self.__dn__, mod_attrs)
|
|
107
107
|
else:
|
|
108
|
-
print("ADD VALUE member = {} FOR {
|
|
108
|
+
print(f"ADD VALUE member = {mod[2]} FOR {self.__dn__}")
|
|
109
109
|
|
|
110
110
|
@reconnect_on_fail
|
|
111
111
|
def del_member(self, member, dn=False):
|
|
@@ -133,5 +133,4 @@ class CSHGroup:
|
|
|
133
133
|
mod_attrs = [mod]
|
|
134
134
|
self.__con__.modify_s(self.__dn__, mod_attrs)
|
|
135
135
|
else:
|
|
136
|
-
print("DELETE VALUE member = {} FOR {}"
|
|
137
|
-
self.__dn__))
|
|
136
|
+
print(f"DELETE VALUE member = {mod[2]} FOR {self.__dn__}")
|
|
@@ -24,13 +24,13 @@ class CSHMember:
|
|
|
24
24
|
res = self.__con__.search_s(
|
|
25
25
|
self.__ldap_user_ou__,
|
|
26
26
|
ldap.SCOPE_SUBTREE,
|
|
27
|
-
"(uid
|
|
27
|
+
f"(uid={search_val})",
|
|
28
28
|
['ipaUniqueID'])
|
|
29
29
|
else:
|
|
30
30
|
res = self.__con__.search_s(
|
|
31
31
|
self.__ldap_user_ou__,
|
|
32
32
|
ldap.SCOPE_SUBTREE,
|
|
33
|
-
"(ipaUniqueID
|
|
33
|
+
f"(ipaUniqueID={search_val})",
|
|
34
34
|
['uid'])
|
|
35
35
|
|
|
36
36
|
if res:
|
|
@@ -51,7 +51,7 @@ class CSHMember:
|
|
|
51
51
|
def __repr__(self):
|
|
52
52
|
"""Generate a str representation of the bound CSH LDAP member object.
|
|
53
53
|
"""
|
|
54
|
-
return "CSH Member(dn:
|
|
54
|
+
return f"CSH Member(dn: {self.__dn__})"
|
|
55
55
|
|
|
56
56
|
def get(self, key):
|
|
57
57
|
"""Get an attribute from the bound CSH LDAP member object.
|
|
@@ -59,7 +59,7 @@ class CSHMember:
|
|
|
59
59
|
Arguments:
|
|
60
60
|
key -- the attribute to get the value of
|
|
61
61
|
"""
|
|
62
|
-
return self.__getattr__(key, as_list=True)
|
|
62
|
+
return self.__getattr__(key, as_list=True) # pylint: disable=unnecessary-dunder-call
|
|
63
63
|
|
|
64
64
|
@reconnect_on_fail
|
|
65
65
|
def groups(self):
|
|
@@ -98,6 +98,7 @@ class CSHMember:
|
|
|
98
98
|
"(objectClass=*)",
|
|
99
99
|
[key])
|
|
100
100
|
|
|
101
|
+
print(res)
|
|
101
102
|
if as_list:
|
|
102
103
|
ret = []
|
|
103
104
|
for val in res[0][1][key]:
|
|
@@ -153,7 +154,4 @@ class CSHMember:
|
|
|
153
154
|
mod_str = "ADD"
|
|
154
155
|
else:
|
|
155
156
|
mod_str = "REPLACE"
|
|
156
|
-
print("{} FIELD {} WITH {} FOR {}"
|
|
157
|
-
key,
|
|
158
|
-
value,
|
|
159
|
-
self.__dn__))
|
|
157
|
+
print(f"{mod_str} FIELD {key} WITH {value} FOR {self.__dn__}")
|
|
@@ -25,12 +25,14 @@ def reconnect_on_fail(method):
|
|
|
25
25
|
:return: result of method call
|
|
26
26
|
"""
|
|
27
27
|
max_reconnects = MAX_RECONNECTS
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
def is_cshldap(arg):
|
|
30
|
+
return any(
|
|
29
31
|
filter(
|
|
30
32
|
lambda t: t.__name__ == 'CSHLDAP',
|
|
31
33
|
type(arg).__mro__
|
|
32
|
-
)
|
|
33
34
|
)
|
|
35
|
+
)
|
|
34
36
|
ldap_obj = next(filter(is_cshldap, method_args)) \
|
|
35
37
|
if any(filter(is_cshldap, method_args)) \
|
|
36
38
|
else method_args[0].__lib__
|
|
@@ -55,5 +57,6 @@ def reconnect_on_fail(method):
|
|
|
55
57
|
max_reconnects -= 1
|
|
56
58
|
if max_reconnects == 0:
|
|
57
59
|
raise
|
|
60
|
+
return None
|
|
58
61
|
|
|
59
62
|
return wrapper
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: csh_ldap
|
|
3
|
+
Version: 2.5.2
|
|
4
|
+
Summary: CSH LDAP ORM
|
|
5
|
+
Home-page: https://github.com/ComputerScienceHouse/csh_ldap
|
|
6
|
+
Author: Liam Middlebrook
|
|
7
|
+
Author-email: liammiddlebrook@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Natural Language :: English
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: AUTHORS
|
|
14
|
+
Requires-Dist: python-ldap==3.4.5
|
|
15
|
+
Requires-Dist: srvlookup==3.0.0
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: license
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
# csh_ldap
|
|
25
|
+
|
|
26
|
+
[](https://badge.fury.io/py/csh_ldap)
|
|
27
|
+
[](https://travis-ci.org/liam-middlebrook/csh_ldap)
|
|
28
|
+
|
|
29
|
+
Python 3 ORM for CSH LDAP
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
`pip install csh_ldap`
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
import csh_ldap
|
|
41
|
+
|
|
42
|
+
# Create an unbatched instance
|
|
43
|
+
instance = csh_ldap.CSHLDAP(bind_dn, bind_pw)
|
|
44
|
+
|
|
45
|
+
# Create an batched instance
|
|
46
|
+
instance_batched = csh_ldap.CSHLDAP(bind_dn, bind_pw, batch_mods=True)
|
|
47
|
+
|
|
48
|
+
# Create a Read-Only instance that will only echo your changes
|
|
49
|
+
instance_ro = csh_ldap.CSHLDAP(bind_dn, bind_pw, ro=True)
|
|
50
|
+
|
|
51
|
+
# Get member by UUID
|
|
52
|
+
liam = instance.get_member(uuid_of_liam)
|
|
53
|
+
|
|
54
|
+
# Get member by UID
|
|
55
|
+
liam = instance.get_member(uid_of_liam, uid=True)
|
|
56
|
+
|
|
57
|
+
# Get member by iButton ID
|
|
58
|
+
liam = instance.get_member_ibutton(ibutton_id)
|
|
59
|
+
|
|
60
|
+
# Get member by Slack UID
|
|
61
|
+
liam = instance.get_member_slackuid(slack_uid)
|
|
62
|
+
|
|
63
|
+
# Get group by cn
|
|
64
|
+
rtp = instance.get_group('rtp')
|
|
65
|
+
|
|
66
|
+
# Get cn of member
|
|
67
|
+
print(liam.cn)
|
|
68
|
+
|
|
69
|
+
# Set cn of member
|
|
70
|
+
liam.cn = "Liam Middlebrook"
|
|
71
|
+
|
|
72
|
+
# Setting attributes to None removes them
|
|
73
|
+
liam.roomNumber = None
|
|
74
|
+
|
|
75
|
+
# Process batched writes per-dn
|
|
76
|
+
instance_batched.flush_mod()
|
|
77
|
+
|
|
78
|
+
# Get EBoard Directorship
|
|
79
|
+
# Directorships: ['chairman', 'evaluations', 'financial', 'history', 'imps', 'opcomm', 'research', 'social']
|
|
80
|
+
social = instance.get_directorship_heads('social')
|
|
81
|
+
|
|
82
|
+
for director in social:
|
|
83
|
+
# Directorships are always lists, since it can be multiple people.
|
|
84
|
+
print(director.cn)
|
|
85
|
+
|
|
86
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"git_version": "dbc3193", "is_release": false}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
pycodestyle==2.4.0
|
|
2
|
-
pylint==
|
|
2
|
+
pylint==3.3.8
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = csh_ldap
|
|
3
3
|
author = Liam Middlebrook
|
|
4
|
-
|
|
5
|
-
url = https://github.com/
|
|
4
|
+
author_email = liammiddlebrook@gmail.com
|
|
5
|
+
url = https://github.com/ComputerScienceHouse/csh_ldap
|
|
6
6
|
description = CSH LDAP ORM
|
|
7
7
|
long_description = file: README.md
|
|
8
8
|
long_description_content_type = text/markdown
|
|
9
9
|
license = MIT
|
|
10
|
-
version = 2.
|
|
10
|
+
version = 2.5.2
|
|
11
11
|
classifier =
|
|
12
12
|
Natural Language :: English
|
|
13
13
|
Operating System :: POSIX :: Linux
|
csh_ldap-2.4.0.dev4/PKG-INFO
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: csh_ldap
|
|
3
|
-
Version: 2.4.0.dev4
|
|
4
|
-
Summary: CSH LDAP ORM
|
|
5
|
-
Home-page: https://github.com/liam-middlebrook/csh_ldap
|
|
6
|
-
Author: Liam Middlebrook
|
|
7
|
-
Author-email: liammiddlebrook@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: Natural Language :: English
|
|
10
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
License-File: AUTHORS
|
|
14
|
-
|
|
15
|
-
CSH LDAP ORM
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: csh-ldap
|
|
3
|
-
Version: 2.4.0.dev4
|
|
4
|
-
Summary: CSH LDAP ORM
|
|
5
|
-
Home-page: https://github.com/liam-middlebrook/csh_ldap
|
|
6
|
-
Author: Liam Middlebrook
|
|
7
|
-
Author-email: liammiddlebrook@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: Natural Language :: English
|
|
10
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
License-File: AUTHORS
|
|
14
|
-
|
|
15
|
-
CSH LDAP ORM
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"git_version": "a878f24", "is_release": false}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|