summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2016-12-29 08:17:32 -0500
committerLunny Xiao <xiaolunwen@gmail.com>2016-12-29 21:17:32 +0800
commit6f4ba6884c85e5603e7510c0e0d114bc9f86965f (patch)
tree429afe6210a210e1c3c53e539a447240fd1f47ae /modules
parentac51caa517579ca9b495bff031b2affe297ebd25 (diff)
downloadgitea-6f4ba6884c85e5603e7510c0e0d114bc9f86965f.tar.gz
gitea-6f4ba6884c85e5603e7510c0e0d114bc9f86965f.zip
Repo permission bug fixes (#513)
Diffstat (limited to 'modules')
-rw-r--r--modules/context/api.go30
1 files changed, 0 insertions, 30 deletions
diff --git a/modules/context/api.go b/modules/context/api.go
index 7a3ff990b6..725a3461aa 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -75,36 +75,6 @@ func APIContexter() macaron.Handler {
}
}
-// ExtractOwnerAndRepo returns a handler that populates the `Repo.Owner` and
-// `Repo.Repository` fields of an APIContext
-func ExtractOwnerAndRepo() macaron.Handler {
- return func(ctx *APIContext) {
- owner, err := models.GetUserByName(ctx.Params(":username"))
- if err != nil {
- if models.IsErrUserNotExist(err) {
- ctx.Error(422, "", err)
- } else {
- ctx.Error(500, "GetUserByName", err)
- }
- return
- }
-
- repo, err := models.GetRepositoryByName(owner.ID, ctx.Params(":reponame"))
- if err != nil {
- if models.IsErrRepoNotExist(err) {
- ctx.Status(404)
- } else {
- ctx.Error(500, "GetRepositoryByName", err)
- }
- return
- }
- ctx.Repo.Owner = owner
- ctx.Data["Owner"] = owner
- ctx.Repo.Repository = repo
- ctx.Data["Repository"] = repo
- }
-}
-
// ReferencesGitRepo injects the GitRepo into the Context
func ReferencesGitRepo() macaron.Handler {
return func(ctx *APIContext) {