# script to add user to Logan and the Web Server # Adds the user to WEBUSER, SIRDIDHDR and increments the # number in SISETUP for "RD" "AUTO-OBJ-ID",,"000000000111" # # WEBUSER format #"user",,,"EM",1,,,,,,,,,,"user",,,,,"PROD",,"Y",,"Y",,,, # SIRDIDHDR format # # WARNING - IF DEBUG IS SET TO Y for YES then the imports etc WILL NOT HAPPEN. DEBUG="N" CURRSID=`rngdbdump -n logan sisetup -f FIELD-VALUE -v SYSTEM-NAME=RD FIELD-NAME=AUTO-OBJ-ID` THISSID=`expr $CURRSID + 1 ` THISSIRDIDHDR=`printf "%012s" $THISSID` thisdate=`date +%m/%d/%Y` thistime=`date +%H%M%S` if [ "$DEBUG" = "Y" ] then echo $THISSID echo $CURRSID echo $THISSIRDIDHDR echo "$thisdate" echo "$thistime" else clear fi if [ "$DEBUG" = "Y" ] then echo echo "DEBUG IS ON - NO ACTIONS WILL BE PERFORMED." echo "===========================================" echo fi echo Add a new user to Lawson and The Web Server echo ========================================== echo echo echo "New Users UNIX login name? : \c" read NEWU readpass=`grep "^$NEWU:" /etc/passwd | cut -d: -f1` realname="`grep "^$NEWU:" /etc/passwd | cut -d: -f5`" if [ -z "$readpass" ] then echo echo "User $NEWU has not been created in Unix yet. - Add through 'sam' first!." echo exit 1 else echo echo "UNIX: Found : \"$readpass\"" echo " - Real Name: $realname- OK (y/n) :\c" read conf case $conf in y*) echo "" echo "Choose Default Product Line for $NEWU: \c" echo while true do count=1 for i in `rngdbdump -n gen prodline -f ProductLine` do case "$i" in GEN|LOGAN) : ;; *) echo " $count)" $i count=`expr $count + 1` esac done echo " Choose: \c" read PL count=1 ok=0 for i in `rngdbdump -n gen prodline -f ProductLine` do case "$i" in GEN|LOGAN) : ;; *) if [ "$count" = "$PL" ] then ok=1 PL=$i fi count=`expr $count + 1` esac done if [ "$ok" = "1" ] then break fi done echo "" echo " You Selected: $PL" echo \"$NEWU\",4,\"$NEWU\",\"EM\",1,100,,,,,,,,,\"$NEWU\",,,,,\"$PL\",,\"Y\",,\"Y\",,,,>$LADBDIR/exports/logan.add.WEBUSER echo \"$NEWU\",1,1,$THISSID,\"$NEWU\",,\"Employee\",\"$realname\",\"$thisdate\",$thistime>$LADBDIR/exports/logan.add.SIRDIDHDR echo \"RD\",\"AUTO-OBJ-ID\",,\"$THISSIRDIDHDR\",>$LADBDIR/exports/logan.add.SISETUP echo \"$NEWU\",,,,,,,\"MMDDYYYY\",\"/\",,,,,>$LADBDIR/exports/logan.add.USEROPTS echo "Logan/Webuser:" if [ "$DEBUG" = "N" ] then importdb -a LOGAN WEBUSER $LADBDIR/exports/logan.add.WEBUSER 2>&1 importdb -a LOGAN SIRDIDHDR $LADBDIR/exports/logan.add.SIRDIDHDR 2>&1 importdb -a LOGAN SISETUP $LADBDIR/exports/logan.add.SISETUP 2>&1 importdb -a LOGAN USEROPTS $LADBDIR/exports/logan.add.USEROPTS 2>&1 else cat $LADBDIR/exports/logan.add.WEBUSER cat $LADBDIR/exports/logan.add.SIRDIDHDR cat $LADBDIR/exports/logan.add.SISETUP cat $LADBDIR/exports/logan.add.USEROPTS echo "DEBUG - importdb processes NOT PERFORMED." fi echo while true do echo "Choose the new password for $NEWU: \c" read NEWP if [ -z "$NEWP" ] then : else break fi done echo echo "Web Server Password File:" if [ "$DEBUG" = "N" ] then htpasswd -b /usr/prod/HTTPServer/userdb/lawson $NEWU $NEWP else echo "DEBUG - Web Server User NOT ADDED." fi echo exit 0 ;; n*) echo "$0 - exit." exit 0 ;; *) echo "$0 - exit." exit 0 ;; esac fi