[PR #723] [MERGED] Use handlers for API authorization #15541

Closed
opened 2025-11-02 11:48:59 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/723
Author: @ethantkoenig
Created: 1/22/2017
Status: Merged
Merged: 1/26/2017
Merged by: @lunny

Base: masterHead: api/refactor


📝 Commits (1)

  • 57240a5 Use handlers for API authorization

📊 Changes

5 files changed (+100 additions, -131 deletions)

View changed files

routers/api/v1/admin/org_repo.go (+0 -52)
📝 routers/api/v1/api.go (+26 -14)
📝 routers/api/v1/org/member.go (+2 -11)
📝 routers/api/v1/org/org.go (+0 -5)
📝 routers/api/v1/org/team.go (+72 -49)

📄 Description

There were already handlers for enforcing organization membership/ownership in api.go (reqOrgMembership() and reqOrgOwnership()), but a lot of API endpoints did not use them. Using the handlers eliminates a lot of duplicated code.

I also moved endpoints that should not require admin (add/remove a repo to a team) out of api/v1/admin/, and fixed an incorrect error message in reqOrgOwnership().


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/723 **Author:** [@ethantkoenig](https://github.com/ethantkoenig) **Created:** 1/22/2017 **Status:** ✅ Merged **Merged:** 1/26/2017 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `api/refactor` --- ### 📝 Commits (1) - [`57240a5`](https://github.com/go-gitea/gitea/commit/57240a531ade481b629d0a6fca51a266fad1a687) Use handlers for API authorization ### 📊 Changes **5 files changed** (+100 additions, -131 deletions) <details> <summary>View changed files</summary> ➖ `routers/api/v1/admin/org_repo.go` (+0 -52) 📝 `routers/api/v1/api.go` (+26 -14) 📝 `routers/api/v1/org/member.go` (+2 -11) 📝 `routers/api/v1/org/org.go` (+0 -5) 📝 `routers/api/v1/org/team.go` (+72 -49) </details> ### 📄 Description There were already handlers for enforcing organization membership/ownership in `api.go` (`reqOrgMembership()` and `reqOrgOwnership()`), but a lot of API endpoints did not use them. Using the handlers eliminates a lot of duplicated code. I also moved endpoints that should not require admin (add/remove a repo to a team) out of `api/v1/admin/`, and fixed an incorrect error message in `reqOrgOwnership()`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 11:48:59 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#15541