Skip to content

Commit

Permalink
Merge pull request #72 from atlas-bi/alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherpickering authored Apr 4, 2023
2 parents 8f9c495 + 5d6a708 commit 5f7fa1c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ jobs:
with:
useLockFile: false

- name: 🐍 Setup Poetry
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: 🎶 Setup Poetry
uses: snok/install-poetry@v1

- name: 🚀 Semantic Release
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
exclude: docs*
additional_dependencies: [toml]
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ LDAP_HOST=localhost
LDAP_USERNAME=cn=admin,dc=example,dc=org
LDAP_PASSWORD=adminpassword
LDAP_BASE=dc=example,dc=org
LDAP_GROUP_SEARCH=(objectClass=group)
LDAP_USER_SEARCH=(&(objectClass=person)(sAMAccountName=*))
LDAP_USE_SSL=False
LDAP_USE_TLS=False
AD_DOMAIN=EXAMPLEHEALTH
LDAP_GROUP_SEARCH=(objectClass=group)
# optionally limit results to dn's that contain an ou.
# this is not possible in AD search filters, so we do it
# in the python. This should be a comma list of OU names.
Expand Down Expand Up @@ -112,4 +112,4 @@ LDAP_USE_SSL=false
LDAP_USE_TLS=false
```

3. Run tests `poetry run tox -e test`
3. Run tests `poetry run tox -e test`
10 changes: 5 additions & 5 deletions ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,24 @@ def main():

users.append(row)

if "memberOf" in data:
for member_set in data["memberOf"]:
if "memberOf" in attributes:
for member_set in attributes["memberOf"]:
# one CN
cn = re.findall(r"CN=(.+?)(?=,?(?:OU|DC|CN|$))", member_set)[0]

# for multiple OUs
ou_list = re.findall(r"OU=(.+?)(?=,?(?:OU|DC|CN|$))", member_set)

for ou in ou_list:
memberrow = [
prefixer(
get_attribute("sAMAccountName", data), AD_DOMAIN + "\\"
get_attribute("sAMAccountName", attributes),
AD_DOMAIN + "\\",
),
ou,
cn,
]

if not LDAP_GROUP_OU or ou in LDAP_GROUP_OU.split():
if not LDAP_GROUP_OU or ou in LDAP_GROUP_OU.split(","):
memberships.append(memberrow)

generator = conn.extend.standard.paged_search(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "atlas-etl-ldap",
"version": "2.0.0",
"version": "2.0.0-alpha.2",
"description": "Atlas BI Library LDAP ETL",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "atlas-etl-ldap"
version = "2.0.0"
version = "2.0.0-alpha.2"
description = "Atlas BI Library LDAP ETL"
authors = ["Christopher Pickering <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down

0 comments on commit 5f7fa1c

Please sign in to comment.