diff --git a/utils/assign-role.bash b/utils/assign-role.bash index c8d8ee625fc0ef3e751c03ba5e16f38aa97d5795..f782281428875a5158f8273f2d3be5a7839a18df 100755 --- a/utils/assign-role.bash +++ b/utils/assign-role.bash @@ -1,6 +1,6 @@ #!/bin/bash -if [[ $1 == "" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then +if [[ $1 == "" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]] || [[ $2 == "" ]]; then echo "usage: $0 USERNAME ROLE [ SERVER ]"; exit 0; fi @@ -9,19 +9,12 @@ USERNAME=$1 ROLE=$2 SERVER=$3 - -if [[ $USERNAME == "" ]] || [[ $ROLE == "" ]]; then - echo "Please specify username and role" - echo "usage: $0 USERNAME ROLE [ SERVER ]"; - exit 1 -fi - if [[ $SERVER == "" ]]; then - SERVER=localhost:5000 + SERVER=http://localhost:5000 fi echo "Assigning role $ROLE to User $USERNAME" curl --header "Content-Type: application/json" \ --request POST \ --data "{\"query\": \"mutation {addRoleToUser(username: \\\"$USERNAME\\\", role: \\\"$ROLE\\\"){user{username, roles{edges{node{name}}}}}}\" }" \ - http://$SERVER/graphql + $SERVER/graphql diff --git a/utils/create-application.bash b/utils/create-application.bash index fa29650c93db6b60f65eac201c589957559f754f..ad33e5204db559778354f50ab7ac9af46380098d 100755 --- a/utils/create-application.bash +++ b/utils/create-application.bash @@ -9,11 +9,11 @@ APPLICATION=$1 SERVER=$2 if [[ $SERVER == "" ]]; then - SERVER=localhost:5000 + SERVER=http://localhost:5000 fi echo "Creating application $APPLICATION" curl --header "Content-Type: application/json" \ --request POST \ --data "{\"query\": \"mutation {createApplication(name: \\\"$APPLICATION\\\"){application{name}}}\" }" \ - http://$SERVER/graphql + $SERVER/graphql diff --git a/utils/create-role.bash b/utils/create-role.bash index dc8e5384da4eb2de74ecd112aaee2999ead0cb2c..15c6209fba6bbf22227206c85d0b7539c42428e9 100755 --- a/utils/create-role.bash +++ b/utils/create-role.bash @@ -9,11 +9,11 @@ ROLE=$1 SERVER=$2 if [[ $SERVER == "" ]]; then - SERVER=localhost:5000 + SERVER=http://localhost:5000 fi echo "Creating role $ROLE" curl --header "Content-Type: application/json" \ --request POST \ --data "{\"query\": \"mutation {createRole(name: \\\"$ROLE\\\"){role{name}}}\" }" \ - http://$SERVER/graphql + $SERVER/graphql diff --git a/utils/create-user.bash b/utils/create-user.bash index 96400416dd8f08c670f0d33c2111ddaaf5646495..0a24f4940caf145b6bb4dee7f47a4bf0482a33e1 100755 --- a/utils/create-user.bash +++ b/utils/create-user.bash @@ -1,6 +1,6 @@ #!/bin/bash -if [[ $1 == "" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then +if [[ $1 == "" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]] || [[ $2 == "" ]] || [[ $3 == "" ]]; then echo "usage: $0 USERNAME PASSWORD EMAIL [ SERVER ]"; exit 0; fi @@ -10,18 +10,12 @@ PASSWORD=$2 EMAIL=$3 SERVER=$4 -if [[ $USERNAME == "" ]] || [[ $PASSWORD == "" ]] || [[ $EMAIL == "" ]]; then - echo "Please specify username, password and email address" - echo "usage: $0 USERNAME PASSWORD EMAIL [ SERVER ]"; - exit 1 -fi - if [[ $SERVER == "" ]]; then - SERVER=localhost:5000 + SERVER=http://localhost:5000 fi echo "Creating admin user" curl --header "Content-Type: application/json" \ --request POST \ --data "{\"query\": \"mutation {createUser(username: \\\"$USERNAME\\\", password: \\\"$PASSWORD\\\", email: \\\"$EMAIL\\\"){user{username}}}\" }" \ - http://$SERVER/graphql + $SERVER/graphql diff --git a/utils/grant-access.bash b/utils/grant-access.bash index 3b52d9d65dcf156f3a5c427c4dca006290ff80a6..0c14048b8a52257f00e63958fa1ffc0d31be42ca 100755 --- a/utils/grant-access.bash +++ b/utils/grant-access.bash @@ -1,6 +1,6 @@ #!/bin/bash -if [[ $1 == "" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then +if [[ $1 == "" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]] || [[ $2 == "" ]]; then echo "usage: $0 USERNAME APPLICATION [ SERVER ]"; exit 0; fi @@ -9,18 +9,12 @@ USERNAME=$1 APPLICATION=$2 SERVER=$3 -if [[ $USERNAME == "" ]] || [[ $APPLICATION == "" ]]; then - echo "Please specify username and application" - echo "usage: $0 USERNAME APPLICATION [ SERVER ]"; - exit 1 -fi - if [[ $SERVER == "" ]]; then - SERVER=localhost:5000 + SERVER=http://localhost:5000 fi echo "Granting access to application $APPLICATION to User $USERNAME" curl --header "Content-Type: application/json" \ --request POST \ --data "{\"query\": \"mutation {addApplicationToUser(username: \\\"$USERNAME\\\", application: \\\"$APPLICATION\\\"){user{username, applications{edges{node{name}}}}}}\" }" \ - http://$SERVER/graphql + $SERVER/graphql