Skip to content
Snippets Groups Projects
Verified Commit 2ce58f8a authored by Mark's avatar Mark
Browse files

Refactor util scripts

parent 7d94b3f4
No related branches found
No related tags found
1 merge request!1Integration
#!/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
......@@ -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
......@@ -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
#!/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
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment