26 lines
667 B
Bash
Executable File
26 lines
667 B
Bash
Executable File
#!/bin/bash
|
|
# Query: permissions - List permissions
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "${SCRIPT_DIR}/../apikey"
|
|
|
|
ROLE_NAME="${1:-}"
|
|
|
|
if [ -n "$ROLE_NAME" ]; then
|
|
QUERY='query GetPermissions($roleName: String) { permissions(roleName: $roleName) { name group } }'
|
|
VARIABLES="{\"roleName\": \"${ROLE_NAME}\"}"
|
|
else
|
|
QUERY='query GetPermissions { permissions { name group } }'
|
|
VARIABLES='{}'
|
|
fi
|
|
|
|
curl -s -X POST "https://graphql.ordrestyring.dk/graphql" \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: Bearer ${API_KEY}" \
|
|
--data-binary @- <<EOF | jq '.'
|
|
{
|
|
"query": "${QUERY}",
|
|
"variables": ${VARIABLES}
|
|
}
|
|
EOF
|