From 566e8ecce0df27e09d9f3ed9503f788827cc1102 Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Mon, 18 Sep 2017 16:52:20 +0200 Subject: Fork permission bug fixes (#2534) * Hotfix for "Add time manually" (https://github.com/go-gitea/gitea/pull/2211#issuecomment-328780125) Signed-off-by: Jonas Franz * Checking if Code unit is enabled before creating a fork. Signed-off-by: Jonas Franz * Adding a discrete function for RepoIDAssignment Signed-off-by: Jonas Franz * Improved Documentation --- routers/routes/routes.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'routers/routes') diff --git a/routers/routes/routes.go b/routers/routes/routes.go index a0684c8478..c5d6793ff3 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -419,8 +419,10 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost) m.Get("/migrate", repo.Migrate) m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost) - m.Combo("/fork/:repoid").Get(repo.Fork). - Post(bindIgnErr(auth.CreateRepoForm{}), repo.ForkPost) + m.Group("/fork", func() { + m.Combo("/:repoid").Get(repo.Fork). + Post(bindIgnErr(auth.CreateRepoForm{}), repo.ForkPost) + }, context.RepoIDAssignment(), context.UnitTypes(), context.LoadRepoUnits(), context.CheckUnit(models.UnitTypeCode)) }, reqSignIn) m.Group("/:username/:reponame", func() { -- cgit v1.2.3