message: Add View All Groups permission
diff: @@ -1259,6 +1259,33 @@ EOF
  # {"type":"scope","logic":"POSITIVE","decisionStrategy":"UNANIMOUS","name":"Backup View","resources":["2ebb5852-6624-4dc6-8374-e1e54a7fd9c5"],"scopes":["8e78b877-f930-43ff-995f-c907af64f69f"],"policies":["d4fae4e2-ddc7-462c-b712-d68aaeb269e1"]}
  }
  +function add_group_viewall {
  + CLIENT_ID=$(/opt/jboss/keycloak/bin/kcadm.sh get -r lagoon clients?clientId=api --config $CONFIG_PATH | python -c 'import sys, json; print json.load(sys.stdin)[0]["id"]')
  + view_all_groups=$(/opt/jboss/keycloak/bin/kcadm.sh get -r lagoon clients/$CLIENT_ID/authz/resource-server/permission?name=View+All+Groups --config $CONFIG_PATH)
  +
  + if [ "$view_all_groups" != "[ ]" ]; then
  + echo "group:viewAll already configured"
  + return 0
  + fi
  +
  + echo Configuring group:viewAll
  +
  + GROUP_RESOURCE_ID=$(/opt/jboss/keycloak/bin/kcadm.sh get -r lagoon clients/$CLIENT_ID/authz/resource-server/resource?name=group --config $CONFIG_PATH | python -c 'import sys, json; print json.load(sys.stdin)[0]["_id"]')
  + /opt/jboss/keycloak/bin/kcadm.sh update clients/$CLIENT_ID/authz/resource-server/resource/$GROUP_RESOURCE_ID --config $CONFIG_PATH -r ${KEYCLOAK_REALM:-master} -s 'scopes=[{"name":"add"},{"name":"update"},{"name":"delete"},{"name":"deleteAll"},{"name":"addUser"},{"name":"removeUser"},{"name":"viewAll"}]'
  +
  + /opt/jboss/keycloak/bin/kcadm.sh create clients/$CLIENT_ID/authz/resource-server/permission/scope --config $CONFIG_PATH -r lagoon -f - <<EOF
  +{
  + "name": "View All Groups",
  + "type": "scope",
  + "logic": "POSITIVE",
  + "decisionStrategy": "UNANIMOUS",
  + "resources": ["group"],
  + "scopes": ["viewAll"],
  + "policies": ["Users role for realm is Platform Owner"]
  +}
  +EOF
  +}
  +
  function configure_keycloak {
  until is_keycloak_running; do
  echo Keycloak still not running, waiting 5 seconds
  @@ -1275,6 +1302,7 @@ function configure_keycloak {
  configure_lagoon_realm
  configure_lagoon_searchguard_client
  configure_api_client
  + add_group_viewall
  echo "Config of Keycloak done. Log in via admin user '$KEYCLOAK_ADMIN_USER' and password '$KEYCLOAK_ADMIN_PASSWORD'"
  }
  