Crysalix/actions/add_user_in_group·sh

20 lines
497 B
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
source ./sources/functions.sh
banner "Adding user in group"
sleep 1
log info "Search all users..."
sleep 1
SELECTED_USER=$(ldapsearch -x -LLL -H ldap://${LDAP_SERVER} -b "${LDAP_BASE_DN}" "(objectClass=inetOrgPerson)" dn | grep '^dn' | sed 's/dn: //g' | fzf --height=10 --reverse --cycle --prompt=" Choix : " -m)
if [ -z "$SELECTED_USER" ]; then
log error "No user selected"
else
log success "User selected : "
for i in $SELECTED_USER; do
echo -e " - ${i}"
done
fi