-
Notifications
You must be signed in to change notification settings - Fork 90
fix: filter user groups by env scope in query parameter #13890
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: filter user groups by env scope in query parameter #13890
Conversation
a48b71b to
3ac9b1d
Compare
Summary of ChangesHello @vikrantgravitee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical bug in the user group retrieval API. Previously, when requesting user groups for a specific environment, the system erroneously returned all groups associated with the user across the entire organization. The changes introduce a new service method and update the API endpoint to correctly filter these groups by the provided environment ID, ensuring that only groups relevant to the specified environment are returned. This enhances data accuracy and adheres to the intended scope of the API. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly fixes an issue where user groups were not being filtered by environment. The approach of adding a new service method findByUserAndEnvironment and using it in the UserResource is sound. The new logic is also well-tested. I've added a few suggestions to improve code cleanliness and adherence to best practices.
...t/src/main/java/io/gravitee/rest/api/management/rest/resource/organization/UserResource.java
Outdated
Show resolved
Hide resolved
...-apim-rest-api-service/src/main/java/io/gravitee/rest/api/service/impl/GroupServiceImpl.java
Show resolved
Hide resolved
...c/test/java/io/gravitee/rest/api/service/impl/GroupService_FindByUserAndEnvironmentTest.java
Show resolved
Hide resolved
455ab68 to
8d22add
Compare
|
A user is attached to an organization. We should use What is the use case you are trying to fix here ? |
dd8e5b6 to
3eb1fe5
Compare
3eb1fe5 to
c0548b8
Compare
Thank you @phiz71 for pointing it out and for the right suggestion. Use case: |
...t/src/main/java/io/gravitee/rest/api/management/rest/resource/organization/UserResource.java
Outdated
Show resolved
Hide resolved
...ement-rest/src/test/java/io/gravitee/rest/api/management/rest/resource/UserResourceTest.java
Show resolved
Hide resolved
...t/src/main/java/io/gravitee/rest/api/management/rest/resource/organization/UserResource.java
Show resolved
Hide resolved
2a10d6a to
febbb65
Compare
|
New test after new code changes per suggestion: Screen.Recording.2025-11-13.at.10.37.00.AM.mov |
febbb65 to
f3ab813
Compare
f3ab813 to
6ad4afe
Compare
Issue
https://gravitee.atlassian.net/browse/APIM-10981
Description
The UserResource.getUserGroups endpoint now correctly filters groups by environment when the 'q' query parameter is provided with valid environmentId.
Sample:
management/organizations/{orgID}/users/{userID}/groups?q={envID} => filters data based on envID
management/organizations/{orgID}/users/{userID}/groups => provides full list of groups for the user
The issue was that old API is already deprecated GET management/organizations/{orgId}/environments/{envId}/users/{userId}/groups but if user wants to filter data based on the envId then there was no option to do so.
Changes:
Previously, the endpoint returned all organization groups and no option was available for end user to filter data based on environment id.
Screen.Recording.2025-11-02.at.12.19.35.PM.mov
Updated fix with QUERY PARAM:
Screen.Recording.2025-11-11.at.9.59.02.PM.mov
Additional context