Redbrick User management tool
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.

42 lines
887 B

  1. #! /bin/bash
  2. HOST=atlas.dcu.ie
  3. ATTRS="dn cn sn givenName gecos mail l objectClass"
  4. TREES="students staff alumni"
  5. OUTPUT=rb-dcu-tree.ldif
  6. for i in $TREES; do
  7. echo "Getting $i..."
  8. ldapsearch -LLL -x -h $HOST -b ou="$i",o=dcu objectClass=person "$ATTRS" > "$i"
  9. done
  10. echo "Generating $OUTPUT"
  11. (cat << EOF
  12. dn: ou=dcu,o=redbrick
  13. ou: dcu
  14. objectClass: organizationalUnit
  15. objectClass: top
  16. structuralObjectClass: organizationalUnit
  17. dn: ou=Students,ou=dcu,o=redbrick
  18. ou: Students
  19. objectClass: organizationalUnit
  20. objectClass: top
  21. structuralObjectClass: organizationalUnit
  22. dn: ou=Alumni,ou=dcu,o=redbrick
  23. ou: Alumni
  24. objectClass: organizationalUnit
  25. objectClass: top
  26. structuralObjectClass: organizationalUnit
  27. dn: ou=Staff,ou=dcu,o=redbrick
  28. ou: Staff
  29. objectClass: organizationalUnit
  30. objectClass: top
  31. structuralObjectClass: organizationalUnit
  32. EOF
  33. ./fixup-rb-dcu-tree.py < "$TREES") > $OUTPUT