diff options
author | Unknwon <u@gogs.io> | 2015-02-28 21:50:29 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-02-28 21:50:29 -0500 |
commit | b0b11fd7b1bd5e556c27ccae73668b7df74cd73e (patch) | |
tree | 134a3b875952990ffe83f5b583d461b6b2e942df /routers/repo/http.go | |
parent | 3a6ba39a61c68d967c6c08aa087d2de2d0bf7ec0 (diff) | |
parent | f44204e9449c09e0fef37a4974dc2f2043593d6f (diff) | |
download | gitea-b0b11fd7b1bd5e556c27ccae73668b7df74cd73e.tar.gz gitea-b0b11fd7b1bd5e556c27ccae73668b7df74cd73e.zip |
Merge branch 'access' of github.com:gogits/gogs into dev
Diffstat (limited to 'routers/repo/http.go')
-rw-r--r-- | routers/repo/http.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go index 35338fefbe..3cfc065999 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -131,18 +131,18 @@ func Http(ctx *middleware.Context) { } if !isPublicPull { - var tp = models.WRITABLE + var tp = models.ACCESS_MODE_WRITE if isPull { - tp = models.READABLE + tp = models.ACCESS_MODE_READ } - has, err := models.HasAccess(authUsername, username+"/"+reponame, tp) + has, err := models.HasAccess(authUser, repo, tp) if err != nil { ctx.Handle(401, "no basic auth and digit auth", nil) return } else if !has { - if tp == models.READABLE { - has, err = models.HasAccess(authUsername, username+"/"+reponame, models.WRITABLE) + if tp == models.ACCESS_MODE_READ { + has, err = models.HasAccess(authUser, repo, models.ACCESS_MODE_WRITE) if err != nil || !has { ctx.Handle(401, "no basic auth and digit auth", nil) return @@ -152,6 +152,11 @@ func Http(ctx *middleware.Context) { return } } + + if !isPull && repo.IsMirror { + ctx.Handle(401, "can't push to mirror", nil) + return + } } } |