Skip to content

Commit

Permalink
Merge pull request #3721 from uselagoon/ssh-portal-group-db
Browse files Browse the repository at this point in the history
feat: add query-group permission to the service-api client
  • Loading branch information
tobybellwood authored May 14, 2024
2 parents 6428639 + 082ecc3 commit be36b8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions services/keycloak/lagoon-realm-2.16.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@
"realmRoles": [
"default-roles-lagoon"
],
"clientRoles": {
"realm-management": [
"query-groups"
]
},
"notBefore": 0,
"groups": []
}
Expand Down
10 changes: 10 additions & 0 deletions services/keycloak/startup-scripts/00-configure-lagoon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ function migrate_to_custom_group_mapper {

}

function service-api_add_query-groups_permission {
if /opt/keycloak/bin/kcadm.sh get-roles -r lagoon --uusername service-account-service-api --cclientid realm-management --config /tmp/kcadm.config | jq -e '.[].name|contains("query-groups")' >/dev/null; then
echo "service-api already has query-groups realm-management role"
else
echo "adding service-api query-groups realm-management role"
/opt/keycloak/bin/kcadm.sh add-roles -r lagoon --uusername service-account-service-api --cclientid realm-management --rolename query-groups --config $CONFIG_PATH
fi
}

##################
# Initialization #
##################
Expand Down Expand Up @@ -231,6 +240,7 @@ function configure_keycloak {
check_migrations_version
migrate_to_custom_group_mapper
#post 2.18.0+ migrations after this point
service-api_add_query-groups_permission

# always run last
sync_client_secrets
Expand Down

0 comments on commit be36b8f

Please sign in to comment.