Skip to content

Commit

Permalink
make everyone a member of group Members
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperWallace committed Jun 28, 2015
1 parent 30b3d79 commit d20fddc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions bin/ldap-add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,29 @@ if [ $? -ne 0 ] ; then
# user dosn't exist, so create them
/usr/sbin/smbldap-groupadd -ag "$2" "$1"
if [ -z "$6" ] ; then
/usr/sbin/smbldap-useradd -a -c "$1" -u "$2" -g "$2" -d "/home/$1" -s "$5" -A 1 "$1"
/usr/sbin/smbldap-useradd -a -c "$1" -u "$2" -g "$2" -G Members -d "/home/$1" -s "$5" -A 1 "$1"
else
/usr/sbin/smbldap-useradd -a -c "$1" -u "$2" -g "$2" -d "/home/$1" -s "$5" -A 1 -M "$6" "$1"
/usr/sbin/smbldap-useradd -a -c "$1" -u "$2" -g "$2" -G Members -d "/home/$1" -s "$5" -A 1 -M "$6" "$1"
fi
if [ $? -ne 0 ] ; then
echo "Error adding user"
echo "$1" "$2" "$3" "$4" "$5" "$6"
exit 1
fi
else
# user exists, so modify them.
if [ -z "$6" ] ; then
/usr/sbin/smbldap-usermod -c "$1" -s "$5" "$1"
err=`/usr/sbin/smbldap-usermod -c "$1" -s "$5" -G +Members "$1"`
else
/usr/sbin/smbldap-usermod -c "$1" -s "$5" -M "$6" "$1"
err=`/usr/sbin/smbldap-usermod -c "$1" -s "$5" -G +Members -M "$6" "$1"`
fi

if [ ! -z "$err" ] ; then
echo $err | grep ' already member of the group "Members"' > /dev/null
if [ $? -ne 0 ] ; then
echo "something went wrong with modifing the member"
echo $err
fi
fi
fi

Expand Down

0 comments on commit d20fddc

Please sign in to comment.