Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev -> Main 0.5 release #33

Merged
merged 42 commits into from
Feb 27, 2024
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0fc93a5
Add initial python for updating home areas
adeweetman-al Aug 17, 2023
c6c5ed0
adding comments for future work
adeweetman-al Aug 17, 2023
46d94ba
Merge pull request #9 from ministryofjustice/rbac-uplift
georgepstaylor Aug 18, 2023
53c103c
Update rbac.py
georgepstaylor Aug 18, 2023
84809e6
pre=release
georgepstaylor Aug 18, 2023
80c199d
Merge pull request #10 from ministryofjustice/rbac-uplift
georgepstaylor Aug 18, 2023
ec331aa
prerelease test
georgepstaylor Aug 18, 2023
3176873
Merge pull request #11 from ministryofjustice/rbac-uplift
georgepstaylor Aug 18, 2023
14099e5
PRERELEASE
georgepstaylor Aug 18, 2023
5cff1ab
Merge pull request #12 from ministryofjustice/rbac-uplift
georgepstaylor Aug 18, 2023
fcad740
release work flow test
georgepstaylor Aug 18, 2023
ed0f5ab
Merge pull request #13 from ministryofjustice/rbac-uplift
georgepstaylor Aug 18, 2023
e3879fa
pre release
georgepstaylor Aug 18, 2023
9cbb473
Merge pull request #14 from ministryofjustice/rbac-uplift
georgepstaylor Aug 18, 2023
f3ba407
Update rbac.py
georgepstaylor Aug 18, 2023
61ecf4b
Merge pull request #15 from ministryofjustice/rbac-uplift
georgepstaylor Aug 18, 2023
5977d8c
clean up home area function
Aug 22, 2023
8ed9225
add setuptools requirements
georgepstaylor Aug 22, 2023
8dbcf54
Update setup.py
georgepstaylor Aug 22, 2023
11e13f9
remove quotes unneeded
georgepstaylor Aug 22, 2023
6b15a2c
Merge branch 'dev' into nit815-automate-updating-home-areas
georgepstaylor Aug 22, 2023
4d1a86b
Merge pull request #16 from ministryofjustice/nit815-automate-updatin…
georgepstaylor Aug 22, 2023
84771a2
Retrofit logging and env dict from rbac uplift (#17)
georgepstaylor Aug 23, 2023
5efaeb0
Nit 824 nit 823 - update user roles and user notes (#18)
georgepstaylor Sep 6, 2023
e5b8025
Nit 822 (#19)
georgepstaylor Sep 8, 2023
f8e0fb4
Nit 822 (#20)
georgepstaylor Sep 11, 2023
7c1a1cc
Nit 822 (#21)
georgepstaylor Sep 11, 2023
cf13288
Nit 822 (#22)
georgepstaylor Sep 11, 2023
abd4171
Nit 822 (#23)
georgepstaylor Sep 11, 2023
8e08058
Formatting & linting pre commits (#24)
georgepstaylor Sep 22, 2023
f8620b4
update logging and requirements
georgepstaylor Sep 25, 2023
3903203
NIT-854 Add exception handling and add logging where appropriate
Sep 29, 2023
1deeb0a
NIT-854 fix typos
Sep 29, 2023
1d94eab
Apply suggestions from code review
andrewmooreio Oct 3, 2023
e219c4f
Merge pull request #27 from ministryofjustice/NIT-854-ldap-cli-add-ex…
andrewmooreio Oct 3, 2023
ad0303b
Update rbac.py
georgepstaylor Nov 20, 2023
58759cc
migration to python-ldap - correction on tree deletion (#28)
georgepstaylor Nov 22, 2023
d2529ae
Merge branch 'main' into dev
georgepstaylor Nov 23, 2023
b7188c9
Merge branch 'main' into dev
georgepstaylor Nov 23, 2023
604a5a9
Update .flake8
georgepstaylor Nov 23, 2023
f4e8ea5
Update rbac.py (#31)
georgepstaylor Feb 27, 2024
063ca58
Merge branch 'main' into dev
georgepstaylor Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions cli/ldap_cmds/rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ def context_ldif(
attributes = entry[1]
log.info(f"got entry record: {dn}")
log.debug(attributes)

try:
connection.add_s(
dn,
modlist.addModlist(attributes),
)
log.info(f"{dn} Added")
except ldap.ALREADY_EXISTS as already_exists_e:
log.info(f"{dn} already exists")
log.debug(already_exists_e)
Expand Down Expand Up @@ -198,6 +198,7 @@ def group_ldifs(
dn,
modlist.addModlist(attributes),
)
log.info(f"{dn} Added")
except ldap.ALREADY_EXISTS as already_exists_e:
log.info(f"{dn} already exists")
log.debug(already_exists_e)
Expand Down Expand Up @@ -269,6 +270,7 @@ def policy_ldifs(
dn,
modlist.addModlist(attributes),
)
log.info(f"{dn} Added")
except ldap.ALREADY_EXISTS as already_exists_e:
log.info(f"{dn} already exists")
log.debug(already_exists_e)
Expand Down Expand Up @@ -336,6 +338,7 @@ def role_ldifs(
dn,
modlist.addModlist(attributes),
)
log.info(f"{dn} Added")
except ldap.ALREADY_EXISTS as already_exists_e:
log.info(f"{dn} already exists")
log.debug(already_exists_e)
Expand Down Expand Up @@ -373,6 +376,7 @@ def schema_ldifs(
attributes = entry[1]
print(f" {entry[0]}")
connection.add_s(dn, modlist.addModlist(attributes))
log.info(f"{dn} Added")
except ldap.ALREADY_EXISTS as already_exists_e:
log.info(f"{dn} already exists")
log.debug(already_exists_e)
Expand Down Expand Up @@ -414,7 +418,7 @@ def user_ldifs(
"(objectClass=*)",
)
tree.reverse()
print(tree)

for entry in tree:
try:
log.debug(entry[0])
Expand All @@ -435,14 +439,20 @@ def user_ldifs(
for file in user_files:
records = ldif.LDIFRecordList(open(file, "rb"))
records.parse()

pprint(records.all_records)
# pprint(records.all_records)
# loop through the records
for entry in records.all_records:
dn = entry[0]
attributes = entry[1]
print(f" {entry[0]}")
connection.add_s(dn, modlist.addModlist(attributes))
log.info(f"Got entry record: {dn}")
try:
dn = entry[0]
attributes = entry[1]
print(f" {entry[0]}")
connection.add_s(dn, modlist.addModlist(attributes))
log.info(f"{dn} Added")
except ldap.ALREADY_EXISTS as already_exists_e:
log.info(f"{dn} already exists")
log.debug(already_exists_e)

# connect to ldap
# try:
Expand Down
Loading