removeperson 410 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. . .env
  3. . funcs
  4. uid=$1
  5. if user_exists $uid; then
  6. true
  7. else
  8. echo "User $uid does not exist."
  9. exit 1
  10. fi
  11. read -p "Are you sure you want to delete user $uid [y/N] " a
  12. case $a in
  13. y*|o* )
  14. if user_is_posix $uid; then
  15. ldapdelete $LDAPOPTS cn=$uid,$GROUPSDN
  16. ./removefromgroups $uid $(get_posixGroups $uid)
  17. fi
  18. ldapdelete $LDAPOPTS uid=$uid,$PEOPLEDN ;;
  19. * )
  20. exit;;
  21. esac