add conformation to delete an user

This commit is contained in:
Gilles Mouchet 2024-12-31 07:54:33 +01:00
parent a1597fa7a8
commit efea32e53c

View File

@ -90,12 +90,18 @@ EOF
#------------------------------------------------------------------------------
# delUser
function delUser {
#echo $user_to_del
ldapdelete -x -H $LDAP_SRV -D "$LDAP_MANAGER_USER" -w $LDAP_MANAGER_PASS \
"cn=$user_to_del,ou=people,$LDAP_BASE"
if [ "$?" == "0" ]; then
echo "$user_to_del successfully deleted from directory"
fi
#echo $user_to_del
# request confirmation
echo -e "\nYou will DELETE 'cn=$user_to_del,ou=people,$LDAP_BASE' from the directory"
read -p "Are you sure? " -n 1 -r
echo -e "\n"
if [[ $REPLY =~ ^[Yy]$ ]]; then
ldapdelete -x -H $LDAP_SRV -D "$LDAP_MANAGER_USER" -w $LDAP_MANAGER_PASS \
"cn=$user_to_del,ou=people,$LDAP_BASE"
if [ "$?" == "0" ]; then
echo "$user_to_del successfully deleted from directory"
fi
fi
}
#------------------------------------------------------------------------------
# main