Friday, July 6, 2012

Put it All Together

After beating myself up over the last post, I rolled up my sleeves and got working logic code and it is sending me notifications of who's account password is expiring. I'm still having trouble with getting useable information out of the LDAP hash. I'm probably doing it wrong, so I've asked for a code review and maybe we'll get to the bottom of how Ruby is doing this. I keep getting values in the format of:
["gcolasurdo"] in stead of just gcolasurdo
when I try to get the cn, mail or other LDAP key field.

First, an outline of my code's logic (based on the previous ColdFusion script):
  1. Loop over the relevant OUs (organization units in the LDAP)
  2. Query the LDAP
  3. If there is an expiration date and mail then...
  4. Find the expiration date and calculate the difference from today (script will run daily)
  5. If the daydiff is on a warning interval...
  6. If the OU is for the College of Nursing or everyone else, prepare personalized email text
  7. Then send an email with the details of the impending password expiration
Two questions that came up from the CF code. Should I:
  1. Set a timeout at some point so as to not choke the mail relay
  2. Log the results
One independent question I had:
  1. Should we do anything about already expired passwords (I'm sure the business reason was already set, but as the programmer, I kinda want to make sure)
This is all working locally, so we will need to start in on the deployment process.

Ok, here is the code I'm using:

No comments:

Post a Comment