Переглянути джерело

api/repo: fix incorrect permission values (#4309)

Unknwon 8 роки тому
батько
коміт
55a5ad5cdc
5 змінених файлів з 11 додано та 6 видалено
  1. 1 1
      gogs.go
  2. 1 1
      routers/api/v1/api.go
  3. 5 1
      routers/api/v1/repo/repo.go
  4. 3 2
      routers/user/auth.go
  5. 1 1
      templates/.VERSION

+ 1 - 1
gogs.go

@@ -16,7 +16,7 @@ import (
 	"github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.10.22.0317"
+const APP_VER = "0.10.23.0318"
 
 func init() {
 	setting.AppVer = APP_VER

+ 1 - 1
routers/api/v1/api.go

@@ -242,7 +242,7 @@ func RegisterRoutes(m *macaron.Macaron) {
 
 		m.Group("/repos", func() {
 			m.Post("/migrate", bind(form.MigrateRepo{}), repo.Migrate)
-			m.Combo("/:username/:reponame").Get(repo.Get).
+			m.Combo("/:username/:reponame", repoAssignment()).Get(repo.Get).
 				Delete(repo.Delete)
 
 			m.Group("/:username/:reponame", func() {

+ 5 - 1
routers/api/v1/repo/repo.go

@@ -309,7 +309,11 @@ func Get(ctx *context.APIContext) {
 		return
 	}
 
-	ctx.JSON(200, repo.APIFormat(&api.Permission{true, true, true}))
+	ctx.JSON(200, repo.APIFormat(&api.Permission{
+		Admin: ctx.Repo.IsAdmin(),
+		Push:  ctx.Repo.IsWriter(),
+		Pull:  true,
+	}))
 }
 
 // https://github.com/gogits/go-gogs-client/wiki/Repositories#delete

+ 3 - 2
routers/user/auth.go

@@ -274,8 +274,9 @@ func Activate(ctx *context.Context) {
 				ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
 				mailer.SendActivateAccountMail(ctx.Context, models.NewMailerUser(ctx.User))
 
-				if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
-					log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
+				keyName := "MailResendLimit_" + ctx.User.LowerName
+				if err := ctx.Cache.Put(keyName, ctx.User.LowerName, 180); err != nil {
+					log.Error(2, "Set cache '%s' fail: %v", keyName, err)
 				}
 			}
 		} else {

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.10.22.0317
+0.10.23.0318