admin scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 rivejä
751 B

  1. #!/usr/bin/python
  2. import sys,string
  3. """
  4. Fixing shit I fucked.
  5. Running on the output of this search
  6. ldapsearch -D cn=root,ou=ldap,o=redbrick -y /etc/ldap.secret -xLLL "(|(objectClass=club)(objectClass=society)(objectClass=projects)(objectClass=redbrick)(objectClass=dcu)(objectClass=intersoc)(objectClass=founders))"
  7. """
  8. #print modify ldif template
  9. def modifyTemplate(uid):
  10. dn = 'dn: uid='+uid.strip()
  11. dn += "\nchangetype: modify\ndelete: yearsPaid\n\n"
  12. print dn
  13. #open ldif
  14. with open(sys.argv[1], 'r') as content:
  15. ldif = content.read()
  16. #split by user
  17. getdn = string.split(ldif, 'dn: uid=')
  18. for i in getdn:
  19. try:
  20. thisdn = string.split(i,'\n')
  21. uid = thisdn[0]
  22. if(len(uid) > 0):
  23. modifyTemplate(uid)
  24. except IndexError:
  25. continue