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

Commit 42e751e

Browse files
committed
Merge pull request #8 from PhysiciansDataCollaborative/master
Master
2 parents 3f1e90e + 94aadcc commit 42e751e

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

dacs_add.sh

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ set -o nounset
88
# Expected input
99
#
1010
# $0 this script
11-
# $1 Endpoint number
12-
# $2 Clinician number
13-
# $3 Visualizer login name [optional]
14-
# $4 Jurisdiction [optional]
15-
# $5 Password [optional]
11+
# $1 Doctor (clinician) ID
12+
# $2 Clinic ID
13+
# $3 User name [optional]
14+
# $4 User role [optional]
15+
# $5 Jurisdiction [optional]
16+
# $6 Password [optional]
1617

1718

1819
# Check parameters
@@ -22,28 +23,21 @@ then
2223
echo ""
2324
echo "Unexpected number of parameters."
2425
echo ""
25-
echo "Usage: dacs_add.sh [userName] [userRole] [doctorID] [clinicID] [optional:jurisdiction] [optional:password]"
26+
echo "Usage: dacs_add.sh [doctorID] [clinicID] [op:userName] [op:userRole] [op:jurisdiction] [op:password]"
2627
echo ""
2728
exit
2829
fi
2930

3031

3132
# Set variables from parameters, prompt when password not provided
3233
#
33-
export U_NAME=${1}
34-
export U_ROLE=${2}
35-
export DOCTOR=${3}
36-
export CLINIC=${4}
34+
35+
export DOCTOR=${1}
36+
export CLINIC=${2}
37+
export U_NAME=${3:-$DOCTOR}
38+
export U_ROLE=${4:-admin}
3739
export JURISDICTION=${5:-TEST}
38-
#
39-
if [ $# -eq 5 ]
40-
then
41-
echo "Please provide a password for user "${U_NAME}":"
42-
read -s PASSWORD
43-
echo ""
44-
else
45-
PASSWORD=${6}
46-
fi
40+
export PASSWORD=${6:-sample}
4741

4842

4943
# Add user to DACS
@@ -58,7 +52,7 @@ fi
5852

5953
# Add user to DACS_ROLEFILE, notify if overwriting
6054
#
61-
if ( cat ${DACS_ROLEFILE} | grep -io ^${U_NAME}: )
55+
if ( cat ${DACS_ROLEFILE} | grep -qio ^${U_NAME}: )
6256
then
6357
echo "Existing user role replaced"
6458
sed -i /${U_NAME}:/d ${DACS_ROLEFILE}

dacs_remove.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export JURISDICTION=${2:-$DACS_JURISDICTION}
3939

4040
# Remove user from DACS_ROLEFILE
4141
#
42-
if ( cat ${DACS_ROLEFILE} | grep -io ^${U_NAME}: )
42+
if ( cat ${DACS_ROLEFILE} | grep -qio ^${U_NAME}: )
4343
then
4444
sed -i /${U_NAME}:/d ${DACS_ROLEFILE}
4545
else

0 commit comments

Comments
 (0)