diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-28 15:43:25 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-28 15:43:25 -0400 |
commit | 5dbfe3c26c3dd227e287d52134e978084d5081e3 (patch) | |
tree | 35975dd05e85056d6c7b7e89f0bec1cc46273d80 /routers/repo/repo.go | |
parent | 6e448b07145fbb090e0da6deb97f244c2bfd7ba7 (diff) | |
download | gitea-5dbfe3c26c3dd227e287d52134e978084d5081e3.tar.gz gitea-5dbfe3c26c3dd227e287d52134e978084d5081e3.zip |
Finish organization homepage
Diffstat (limited to 'routers/repo/repo.go')
-rw-r--r-- | routers/repo/repo.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 6cb6c0660e..54e5fcfb20 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -37,11 +37,23 @@ func Create(ctx *middleware.Context) { ctx.Data["LanguageIgns"] = models.LanguageIgns ctx.Data["Licenses"] = models.Licenses + ctxUser := ctx.User + orgId, _ := base.StrTo(ctx.Query("org")).Int64() + if orgId > 0 { + org, err := models.GetUserById(orgId) + if err != nil && err != models.ErrUserNotExist { + ctx.Handle(500, "home.Dashboard(GetUserById)", err) + return + } + ctxUser = org + } + ctx.Data["ContextUser"] = ctxUser + if err := ctx.User.GetOrganizations(); err != nil { ctx.Handle(500, "home.Dashboard(GetOrganizations)", err) return } - ctx.Data["Orgs"] = ctx.User.Orgs + ctx.Data["AllUsers"] = append([]*models.User{ctx.User}, ctx.User.Orgs...) ctx.HTML(200, CREATE) } @@ -76,6 +88,12 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { } return } + + // Check ownership of organization. + if !models.IsOrganizationOwner(u.Id, ctx.User.Id) { + ctx.Error(403) + return + } } repo, err := models.CreateRepository(u, form.RepoName, form.Description, |