Skip to content

Conversation

netvetra
Copy link

@netvetra netvetra commented Aug 6, 2025

…ube projects list for user rights issue #8514

[Refactor][sonarqube] Can you please change API used to obtain SonarQube projects list for user rights issue #8514

Line changed: 134 only.

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation.
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

Replace /api/projects/search with /api/components/search_projects endpoint works without admin rights.

Does this close any open issues?

Closes #8514

Screenshots

N/A

Other Information

N/A

…ube projects list for user rights issue apache#8514

[Refactor][sonarqube] Can you please change API used to obtain SonarQube projects list for user rights issue apache#8514

Line changed: 134 only.
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. component/plugins This issue or PR relates to plugins pr-type/refactor This PR refactors existing features labels Aug 6, 2025
Copy link
Contributor

@klesh klesh left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.
I think we need to add the qualifiers=TRK parameter in order for the API to return projects only according to https://next.sonarqube.com/sonarqube/web_api/api/components

@gpzma
Copy link

gpzma commented Aug 14, 2025

Hi @klesh and @netvetra!

We are also experiencing issues with to obtain SonarQube projects' list due to not user permissions and just came across with this PR. I have seen your changes and we are waiting for this PR to be merged to deploy a new image for our Devlake application. I wanted to confirm, should not we also make the change below in remote_api.go:

if page.Page == 0 {
    page.Page = 1
}
res, err := apiClient.Get("components/search", url.Values{
    "p":          {fmt.Sprintf("%v", page.Page)},
    "ps":         {fmt.Sprintf("%v", page.PageSize)},
    "q":          {keyword},
    "qualifiers": {"TRK"},
}, nil)
if err != nil {
    return
}

klesh
klesh previously approved these changes Aug 21, 2025
@klesh
Copy link
Contributor

klesh commented Aug 21, 2025

Hi @netvetra, have these changes been tested and are they ready to be merged?

Remove a space for:
  backend/plugins/sonarqube/api/blueprint_v200.go:134: File is not `gofmt`-ed with `-s` (gofmt)
  	query.Set("qualifiers", "TRK")
Simply format
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/plugins This issue or PR relates to plugins pr-type/refactor This PR refactors existing features size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor][sonarqube] Can you please change API used to obtain SonarQube projects list for user rights issue
3 participants