This repository was archived by the owner on Nov 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-21
lines changed Expand file tree Collapse file tree 2 files changed +15
-21
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ set -o nounset
8
8
# Expected input
9
9
#
10
10
# $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]
16
17
17
18
18
19
# Check parameters
22
23
echo " "
23
24
echo " Unexpected number of parameters."
24
25
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]"
26
27
echo " "
27
28
exit
28
29
fi
29
30
30
31
31
32
# Set variables from parameters, prompt when password not provided
32
33
#
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}
37
39
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}
47
41
48
42
49
43
# Add user to DACS
58
52
59
53
# Add user to DACS_ROLEFILE, notify if overwriting
60
54
#
61
- if ( cat ${DACS_ROLEFILE} | grep -io ^${U_NAME} : )
55
+ if ( cat ${DACS_ROLEFILE} | grep -qio ^${U_NAME} : )
62
56
then
63
57
echo " Existing user role replaced"
64
58
sed -i /${U_NAME} :/d ${DACS_ROLEFILE}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export JURISDICTION=${2:-$DACS_JURISDICTION}
39
39
40
40
# Remove user from DACS_ROLEFILE
41
41
#
42
- if ( cat ${DACS_ROLEFILE} | grep -io ^${U_NAME} : )
42
+ if ( cat ${DACS_ROLEFILE} | grep -qio ^${U_NAME} : )
43
43
then
44
44
sed -i /${U_NAME} :/d ${DACS_ROLEFILE}
45
45
else
You can’t perform that action at this time.
0 commit comments