Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #8 from PhysiciansDataCollaborative/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
DerekRoberts committed Jun 22, 2015
2 parents 3f1e90e + 94aadcc commit 42e751e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
34 changes: 14 additions & 20 deletions dacs_add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ set -o nounset
# Expected input
#
# $0 this script
# $1 Endpoint number
# $2 Clinician number
# $3 Visualizer login name [optional]
# $4 Jurisdiction [optional]
# $5 Password [optional]
# $1 Doctor (clinician) ID
# $2 Clinic ID
# $3 User name [optional]
# $4 User role [optional]
# $5 Jurisdiction [optional]
# $6 Password [optional]


# Check parameters
Expand All @@ -22,28 +23,21 @@ then
echo ""
echo "Unexpected number of parameters."
echo ""
echo "Usage: dacs_add.sh [userName] [userRole] [doctorID] [clinicID] [optional:jurisdiction] [optional:password]"
echo "Usage: dacs_add.sh [doctorID] [clinicID] [op:userName] [op:userRole] [op:jurisdiction] [op:password]"
echo ""
exit
fi


# Set variables from parameters, prompt when password not provided
#
export U_NAME=${1}
export U_ROLE=${2}
export DOCTOR=${3}
export CLINIC=${4}

export DOCTOR=${1}
export CLINIC=${2}
export U_NAME=${3:-$DOCTOR}
export U_ROLE=${4:-admin}
export JURISDICTION=${5:-TEST}
#
if [ $# -eq 5 ]
then
echo "Please provide a password for user "${U_NAME}":"
read -s PASSWORD
echo ""
else
PASSWORD=${6}
fi
export PASSWORD=${6:-sample}


# Add user to DACS
Expand All @@ -58,7 +52,7 @@ fi

# Add user to DACS_ROLEFILE, notify if overwriting
#
if ( cat ${DACS_ROLEFILE} | grep -io ^${U_NAME}: )
if ( cat ${DACS_ROLEFILE} | grep -qio ^${U_NAME}: )
then
echo "Existing user role replaced"
sed -i /${U_NAME}:/d ${DACS_ROLEFILE}
Expand Down
2 changes: 1 addition & 1 deletion dacs_remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export JURISDICTION=${2:-$DACS_JURISDICTION}

# Remove user from DACS_ROLEFILE
#
if ( cat ${DACS_ROLEFILE} | grep -io ^${U_NAME}: )
if ( cat ${DACS_ROLEFILE} | grep -qio ^${U_NAME}: )
then
sed -i /${U_NAME}:/d ${DACS_ROLEFILE}
else
Expand Down

0 comments on commit 42e751e

Please sign in to comment.