feat(main.sh): add functionality to add users to a group

This commit introduces the ability to add one or more users to a group using the main script. The user is prompted to select this option from the menu, and if chosen, the action/add\_user\_to\_group.sh script is sourced to perform the operation. If an unrecognized choice is made, an error message is displayed and the script exits with a status of 1.
This commit is contained in:
TheHackdes 2026-05-04 20:41:53 +02:00
parent debf81e5a9
commit ea960e5320
3 changed files with 47 additions and 23 deletions

16
main.sh
View file

@ -5,12 +5,10 @@ source ./sources/functions.sh
banner "Manage OpenLDAP"
CHOIX=(
"1. Ajouter un nouveau utilisateur"
"2. Supprimer un utilisateur"
"1. Ajouter un ou plusieurs utilisateurs a un groupe"
)
select_option() {
local choice
choice=$(printf "%s\n" "${CHOIX[@]}" | fzf --height=4 --reverse --cycle --prompt=" Choix : " --layout=reverse)
log info "Selection - ${choice}"
}
@ -18,3 +16,15 @@ select_option() {
sleep 1.5
select_option
case $choice in
"1. Ajouter un ou plusieurs utilisateurs a un groupe")
log success "Ajouter un ou plusieurs utilisateurs a un groupe"
sleep 1
source ./actions/add_user_to_group·sh
;;
*)
log error "Choice non reconnue"
exit 1
;;
esac