diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-28 00:40:07 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-28 00:40:07 -0400 |
commit | 6e448b07145fbb090e0da6deb97f244c2bfd7ba7 (patch) | |
tree | af17fdea008d56d154c1098d05993475c0fee652 /routers/repo/setting.go | |
parent | ee9b7f322ff4c4c14952c2f83fb03e90fa583cad (diff) | |
download | gitea-6e448b07145fbb090e0da6deb97f244c2bfd7ba7.tar.gz gitea-6e448b07145fbb090e0da6deb97f244c2bfd7ba7.zip |
Finish delete organization
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r-- | routers/repo/setting.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 3d48e79c3d..e97eca1239 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -122,13 +122,23 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { return } - if err := models.DeleteRepository(ctx.User.Id, ctx.Repo.Repository.Id, ctx.User.LowerName); err != nil { - ctx.Handle(500, "setting.Delete", err) + if ctx.Repo.Owner.IsOrganization() && + !models.IsOrganizationOwner(ctx.Repo.Owner.Id, ctx.User.Id) { + ctx.Error(403) return } - log.Trace("%s Repository deleted: %s/%s", ctx.Req.RequestURI, ctx.User.LowerName, ctx.Repo.Repository.LowerName) - ctx.Redirect("/") + if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil { + ctx.Handle(500, "setting.Delete(DeleteRepository)", err) + return + } + log.Trace("%s Repository deleted: %s/%s", ctx.Req.RequestURI, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.LowerName) + + if ctx.Repo.Owner.IsOrganization() { + ctx.Redirect("/org/" + ctx.Repo.Owner.Name + "/dashboard") + } else { + ctx.Redirect("/") + } } } |