Skip to content
Snippets Groups Projects

Integration

Merged Mark requested to merge integration into master
Files
7
+ 27
0
#!/bin/bash
if [[ $1 == "" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
echo "usage: $0 USERNAME ROLE [ SERVER ]";
exit 0;
fi
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
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
Loading