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 SQL Query for SearchTeam #20844

Merged
merged 11 commits into from
Aug 21, 2022
Merged

Fix SQL Query for SearchTeam #20844

merged 11 commits into from
Aug 21, 2022

Conversation

Gusted
Copy link
Contributor

@Gusted Gusted commented Aug 18, 2022

  • Currently the function takes in the UserID option, but isn't being used within the SQL query. This patch fixes that by checking that only teams are being returned that the user belongs to.
  • Resolves GET /api/v1/user/teams returns null #20829

- Currently the function takes in the `UserID` option, but isn't being
used within the SQL query. This patch fixes that by checking that only
teams are being returned that the user belongs to.
- Resolves go-gitea#20829
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Aug 18, 2022
integrations/api_user_orgs_test.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 18, 2022
@delvh
Copy link
Member

delvh commented Aug 18, 2022

And some unit tests seem to need an edit…

@Oliver-Hanikel
Copy link

Thanks for fixing this bug

@Gusted
Copy link
Contributor Author

Gusted commented Aug 18, 2022

@delvh @lunny Please re-review again. Especially regarding this line: https://github.com/go-gitea/gitea/pull/20844/files#diff-3d84110fa93e421c3875fcd87a4732305131fc42b65d34d06a1b8e453bee3d80L342 This function is already specified to require organization admin in the router, so no need to specify only the teams that the user belong in

@Gusted Gusted requested review from delvh and lunny August 18, 2022 10:53
routers/web/org/teams.go Show resolved Hide resolved
Co-authored-by: delvh <dev.lh@web.de>
@Gusted
Copy link
Contributor Author

Gusted commented Aug 20, 2022

Interesting CI failure:
image

Gusted pushed a commit to Gusted/gitea that referenced this pull request Aug 20, 2022
- Backport of go-gitea#20844
  - Currently the function takes in the UserID option, but isn't being used within the SQL query. This patch fixes that by checking that only teams are being returned that the user belongs to.
  - Resolves go-gitea#20829
@Gusted Gusted added the backport/done All backports for this PR have been created label Aug 20, 2022
@zeripath
Copy link
Contributor

make lgtm work

@zeripath zeripath merged commit 0b4c166 into go-gitea:main Aug 21, 2022
zeripath pushed a commit that referenced this pull request Aug 21, 2022
Backport #20844

Currently the function takes in the UserID option, but isn't being used within the SQL query. This patch fixes that by checking that only teams are being returned that the user belongs to.
 
Fix  #20829
zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 22, 2022
* giteaofficial/main:
  update current stable version
  [skip ci] Updated translations via Crowdin
  Fix mirror address setting not working (go-gitea#20850)
  Support Proxy protocol (go-gitea#12527)
  Fix SQL Query for `SearchTeam` (go-gitea#20844)
  Double check CloneURL is acceptable (go-gitea#20869)
  Fix graceful doc (go-gitea#20883)
  Pad GPG Key ID with preceding zeroes (go-gitea#20878)
  [skip ci] Updated translations via Crowdin
  call builtinUnused() if internal SSH is disabled (go-gitea#20877)
  Don't open new page for ext wiki on same repository (go-gitea#20725)
  [skip ci] Updated translations via Crowdin
  Fix the mode of custom dir to 0700 in docker-rootless (go-gitea#20861)
  Fix UI mis-align for PR commit history (go-gitea#20845)
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 28, 2022
- Currently the function takes in the `UserID` option, but isn't being
used within the SQL query. This patch fixes that by checking that only
teams are being returned that the user belongs to.

Fix go-gitea#20829

Co-authored-by: delvh <dev.lh@web.de>
@Gusted Gusted deleted the fix-api-user-teams branch September 17, 2022 14:59
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GET /api/v1/user/teams returns null
7 participants