diff options
author | Unknown <joe2010xtmf@163.com> | 2014-05-13 19:26:13 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-05-13 19:26:13 -0400 |
commit | 33ec0632ffd9e770793eba57393f27385d5f392d (patch) | |
tree | 9570ef3f10b5febed8158999ce01176ffd18c0fd | |
parent | f276b37bbbb2fbfb8fd1bcaf7dfff5715861e81c (diff) | |
download | gitea-33ec0632ffd9e770793eba57393f27385d5f392d.tar.gz gitea-33ec0632ffd9e770793eba57393f27385d5f392d.zip |
Fix #183
-rw-r--r-- | modules/middleware/repo.go | 5 | ||||
-rw-r--r-- | routers/repo/setting.go | 3 | ||||
-rw-r--r-- | routers/user/home.go | 3 | ||||
-rw-r--r-- | templates/repo/setting.tmpl | 3 |
4 files changed, 12 insertions, 2 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index bfb1e69da8..cd43539122 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -99,6 +99,11 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler { return } + // Check if the mirror repository owner(mirror repository doesn't have access). + if !ctx.Repo.IsOwner && repo.OwnerId == ctx.User.Id { + ctx.Repo.IsOwner = true + } + // Check access. if repo.IsPrivate && !ctx.Repo.IsOwner { if ctx.User == nil { diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 89c7cb486e..fa4973ecd6 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -83,6 +83,9 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") { ctx.RenderWithErr("Please make sure you entered repository name is correct.", "repo/setting", nil) return + } else if ctx.Repo.Repository.IsMirror { + ctx.Error(404) + return } newOwner := ctx.Query("owner") diff --git a/routers/user/home.go b/routers/user/home.go index b19f3ff4ac..a7a36b4bd7 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -235,8 +235,7 @@ func Issues(ctx *middleware.Context) { return } - err = issues[i].Repo.GetOwner() - if err != nil { + if err = issues[i].Repo.GetOwner(); err != nil { ctx.Handle(500, "user.Issues(GetOwner)", err) return } diff --git a/templates/repo/setting.tmpl b/templates/repo/setting.tmpl index f0f041dee8..99835640fc 100644 --- a/templates/repo/setting.tmpl +++ b/templates/repo/setting.tmpl @@ -88,6 +88,7 @@ Danger Zone </div> + {{if not .Repository.IsMirror}} <div class="panel-body"> <button type="button" class="btn btn-default pull-right" href="#transfer-repository-modal" data-toggle="modal"> Transfer ownership @@ -137,6 +138,8 @@ </div> </div> </div> + {{end}} + <hr> <div class="panel-body"> <button type="button" class="btn btn-default pull-right" href="#delete-repository-modal" data-toggle="modal"> |