python 3 script to put users into static group

beeboo
Contributor

I work 99% in bash, so thats my main language, but currently Im working with python as thats whats working with OKTA.

Currently I get a list of all user status from OKTA, which i need to then compare against and see if there are any overlapping names from JSS.
For any overlap, i need their user id and ALL the computer IDs so that i can put them into specific static groups.

I have this working in shell (without OKTA) but my brain is struggling with python/json and how to work the language.

hoping someone has some insight.

I have simplified the workflow thanks to "import jamf" and "pprint" but so far i have been only able to get a list of all users with their ID and computers with their ID, but its too generic for the workflow.

Ideally it would work like this:

  1. get list of all OKTA user's and their status
  2. put into list/array all OKTA users with deprovionsed status
  3. get list of all JSS users (full data, which i think i can do with a for loop but i havent been succesful with it), where its for each user in (all jss users), get user ID and all computer IDs
  4. in that same for loop, see if the user is in array of deprovisioned users
  5. if they match, add the user ID to static group, and run another for loop to add the computer(s) to the static groups.
0 REPLIES 0