diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-27 16:39:36 +0800 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-27 16:39:36 +0800 |
commit | 9baf2b38d025eaf1d9bbb10a4616c71813ea7054 (patch) | |
tree | a6b8f31a638f2ca286e2c99e1c43c48e59e9c9c6 /routers | |
parent | 50de06056be67ab8433fa796608e38004f2e8733 (diff) |
Bug fix on organization
Diffstat (limited to 'routers')
-rw-r--r-- | routers/install.go | 2 | ||||
-rw-r--r-- | routers/repo/repo.go | 5 | ||||
-rw-r--r-- | routers/repo/setting.go | 19 |
3 files changed, 21 insertions, 5 deletions
diff --git a/routers/install.go b/routers/install.go index c63ac690..3ac35f35 100644 --- a/routers/install.go +++ b/routers/install.go @@ -218,6 +218,8 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { setting.Cfg.SetValue("", "RUN_MODE", "prod") + setting.Cfg.SetValue("log", "MODE", "file") + setting.Cfg.SetValue("security", "INSTALL_LOCK", "true") os.MkdirAll("custom/conf", os.ModePerm) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 7356f503..bbc7cf85 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -142,8 +142,9 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.Data["Title"] = ctx.Tr("new_migrate") ctxUser := ctx.User - if orgId := com.StrTo(ctx.Query("org")).MustInt64(); orgId > 0 { - org, err := models.GetUserById(orgId) + // Not equal means current user is an organization. + if form.Uid != ctx.User.Id { + org, err := models.GetUserById(form.Uid) if err != nil && err != models.ErrUserNotExist { ctx.Handle(500, "GetUserById", err) return diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 866c0cd9..24c1b13a 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -119,9 +119,22 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { if ctx.Repo.Repository.Name != form.RepoName { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil) return - } else if !ctx.Repo.Owner.ValidtePassword(ctx.Query("password")) { - ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil) - return + } + + if ctx.Repo.Owner.IsOrganization() { + if !ctx.Repo.Owner.IsOrgOwner(ctx.User.Id) { + ctx.Error(404) + return + } + if !ctx.User.ValidtePassword(ctx.Query("password")) { + ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil) + return + } + } else { + if !ctx.Repo.Owner.ValidtePassword(ctx.Query("password")) { + ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil) + return + } } if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil { |