Skip to content

ListGroups method to list all child and grandchild groups too#327

Open
ChellaVignesh wants to merge 1 commit into
mainfrom
task/ARTOSI-703-Enable-SubGroups-to-list-in-ListGroups-method
Open

ListGroups method to list all child and grandchild groups too#327
ChellaVignesh wants to merge 1 commit into
mainfrom
task/ARTOSI-703-Enable-SubGroups-to-list-in-ListGroups-method

Conversation

@ChellaVignesh

@ChellaVignesh ChellaVignesh commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What

ListGroups method to list all child and grandchild groups too

Why

To list subgroups during creation of tag permissions

References

https://jira.greenbone.net/browse/ARTOSI-703

Checklist

  • Tests

@ChellaVignesh ChellaVignesh added the alpha release Set label to create an alpha pre release label Jul 16, 2026
@ChellaVignesh ChellaVignesh requested review from a team as code owners July 16, 2026 07:04
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA e723541.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@github-actions

Copy link
Copy Markdown

Conventional Commits Report

😢 No conventional commits found.

👉 Learn more about the conventional commits usage at Greenbone.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.81%. Comparing base (26a48f5) to head (e723541).

Files with missing lines Patch % Lines
pkg/keycloakapi/keycloak_api_client.go 85.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #327      +/-   ##
==========================================
+ Coverage   57.75%   57.81%   +0.06%     
==========================================
  Files          59       59              
  Lines        3082     3096      +14     
==========================================
+ Hits         1780     1790      +10     
- Misses       1165     1167       +2     
- Partials      137      139       +2     
Flag Coverage Δ
opensearch-tests 95.68% <ø> (ø)
postgres-tests 92.03% <ø> (ø)
unit-tests 50.77% <85.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mgoetzegb mgoetzegb self-requested a review July 16, 2026 10:43

@mgoetzegb mgoetzegb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving from Group Name to the Group Path is indeed important as group names are not guaranteed to be unique. Otherwise we can't differentiate between memberships in e.g. Groups

  • GroupA/N1
  • GroupA/N1/N1
  • GroupB/N1

In cases where we want to compare the Group Path with the entry in the JWT token, we need to ensure then that the keycloak group protocol mapper puts the full group path in the token, rather than just the name.

"subGroupCount":2,
"subGroups":[
{"id":"c1","name":"Admins","path":"/Platform/Admins","subGroupCount":0,"subGroups":[]},
{"id":"c2","name":"Users","path":"/Platform/Users","subGroupCount":0,"subGroups":[]}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a subgroup to group Users to verify that we extract the subgroups recursively.

// Group represents a Keycloak group.
type Group struct {
ID string `json:"id"`
Name string `json:"name"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a clarifying comment to the Name property, that this is the full path of the group rather than just the name.

Or maybe even rename the property, it is a breaking change, but it might make the code more clear.

Comment on lines +132 to +135
name := g.Path
if name == "" {
name = g.Name
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reasoning for the special case? Is there a scenario where the path is empty (and the name is not)?

From looking at the test I would assume that path is at least / + <group name> for a root level group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alpha release Set label to create an alpha pre release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants