Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add view-users role to the service-api client #3797

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion services/keycloak/lagoon-realm-base-import.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@
],
"clientRoles": {
"realm-management": [
"query-groups"
"query-groups",
"view-users"
]
},
"notBefore": 0,
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 @@ -634,6 +634,15 @@ EOF
EOF
}

function service-api_add_view-users_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("view-users")' >/dev/null; then
echo "service-api already has view-users realm-management role"
else
echo "adding service-api view-users realm-management role"
/opt/keycloak/bin/kcadm.sh add-roles -r lagoon --uusername service-account-service-api --cclientid realm-management --rolename view-users --config $CONFIG_PATH
fi
}

##################
# Initialization #
##################
Expand Down Expand Up @@ -667,6 +676,7 @@ function configure_keycloak {
migrate_remove_harbor_scan_permissions
remove_deleteall_permissions_scopes
add_update_platform_viewer_permissions
service-api_add_view-users_permission

# always run last
sync_client_secrets
Expand Down