Skip to content

Commit

Permalink
Dev -> Main 0.4 release (#33)
Browse files Browse the repository at this point in the history
* Add initial python for updating home areas

* adding comments for future work

* Update rbac.py

* pre=release

* prerelease test

* PRERELEASE

* release work flow test

* pre release

* Update rbac.py

* clean up home area function

* add setuptools requirements

* Update setup.py

* remove quotes unneeded

* Retrofit logging and env dict from rbac uplift (#17)

* flexibility

* logging

* add shorthand options

* options for log levels

* Update logging.py

* Update __init__.py

* Nit 824 nit 823 - update user roles and user notes (#18)

* new functions and structure

* find common entries in both

* refactor + python rewrite foruser roles

* remove action

* remove debugging

* start oracle db

* add update notes

* typo + rm commented code

* refactor + comments

* Update __init__.py

* fix logger duplicates

* re format + remove print debugging

* log levels + debugging

* Update logger.py

* fixes requirements

* reformat connection for oracle

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* bind by name

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* Update user.py

* add handling for user notes

* Nit 822 (#19)

* add CRC user script

* add click cmd

* add deactivate-crc-users to main group

* Update user.py

* Update requirements.txt

---------

Co-authored-by: Seb Norris <[email protected]>

* Nit 822 (#20)

* add CRC user script

* add click cmd

* add deactivate-crc-users to main group

* Update user.py

* Update requirements.txt

* Update rbac.py

---------

Co-authored-by: Seb Norris <[email protected]>

* Nit 822 (#21)

* add CRC user script

* add click cmd

* add deactivate-crc-users to main group

* Update user.py

* Update requirements.txt

* Update rbac.py

* no token needed for rbac

---------

Co-authored-by: Seb Norris <[email protected]>

* Nit 822 (#22)

* add CRC user script

* add click cmd

* add deactivate-crc-users to main group

* Update user.py

* Update requirements.txt

* Update rbac.py

* no token needed for rbac

* Update rbac.py

---------

Co-authored-by: Seb Norris <[email protected]>

* Nit 822 (#23)

* add CRC user script

* add click cmd

* add deactivate-crc-users to main group

* Update user.py

* Update requirements.txt

* Update rbac.py

* no token needed for rbac

* Update rbac.py

* ldap config dict or local val

---------

Co-authored-by: Seb Norris <[email protected]>

* Formatting & linting pre commits (#24)

* add pre commit

* Update readme.md

* format

* Update tag-and-release.yml

* Update pyproject.toml

* Update .flake8

* Update .flake8

* use black defualt

* format to black defaults

* update black to latest

* remove boilerplate excludes

* update logging and requirements

* NIT-854 Add exception handling and add logging where appropriate

* NIT-854 fix typos

* Apply suggestions from code review

Co-authored-by: George Taylor <[email protected]>

* Update rbac.py

* migration to python-ldap - correction on tree deletion (#28)

* Merge branch 'main' into dev

* Update .flake8

* Update rbac.py (#31)

---------

Co-authored-by: adrianweetman <[email protected]>
Co-authored-by: Seb Norris <[email protected]>
Co-authored-by: Andrew Moore <[email protected]>
Co-authored-by: Andrew Moore <[email protected]>
  • Loading branch information
5 people authored Feb 27, 2024
1 parent ff44de7 commit 40d09ec
Showing 1 changed file with 18 additions and 8 deletions.
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

0 comments on commit 40d09ec

Please sign in to comment.