Skip to content

Commit 4dbda72

Browse files
committed
389/389_useradd.sh: add check to email
We should be using non-CGIAR addresses when we add users so that it is possible to contact them after they leave the institute!
1 parent 5aa3973 commit 4dbda72

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

389/389_useradd.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function usage {
3131
Usage: $PROGNAME -f FirstName -l LastName [ -u username -i userid -g groupid -p password -e email]
3232
3333
Optional arguments:
34-
-e: user email address
34+
-e: user email address (NOT a CGIAR address!)
3535
-g: numeric groupid (default: latest available)
3636
-i: numeric userid (default: latest available)
3737
-p: password (default: $DEF_PASSWORD)
@@ -79,6 +79,16 @@ if [[ -z "$USERNAME" ]]; then
7979
USERNAME=$(echo "${FIRSTINITIAL}${LASTNAME}" | tr '[:upper:]' '[:lower:]')
8080
fi
8181

82+
# Make sure the email address is NOT a CGIAR one so that we can contact
83+
# the user after they leave the institute!
84+
if [[ ! -z "$EMAIL" ]]; then
85+
if [[ "$EMAIL" =~ cgiar\.org ]]; then
86+
echo "Email should be a non-CG address so we can contact the user after they leave."
87+
88+
exit 1
89+
fi
90+
fi
91+
8292
# Print LDIF for user account
8393
printf 'dn: uid=%s, ou=People, dc=ilri,dc=cgiar,dc=org\n' "$USERNAME"
8494
printf 'changetype: add\n'

0 commit comments

Comments
 (0)