diff options
author | Unknwon <u@gogs.io> | 2017-04-06 23:48:49 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-06 23:48:49 -0400 |
commit | ac43eab51f9ac0d4c4bcc6db2bbc9ce3dbb34b7b (patch) | |
tree | 4e5fd54b821ef1af312e4d1f1c1a9befad7054a7 /routers/api/v1 | |
parent | 8d0417497b39aa196400d39c99bbd79cfb364f9f (diff) |
Refactoring: rename Signed -> Logged
Diffstat (limited to 'routers/api/v1')
-rw-r--r-- | routers/api/v1/api.go | 8 | ||||
-rw-r--r-- | routers/api/v1/repo/repo.go | 2 | ||||
-rw-r--r-- | routers/api/v1/user/user.go | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index d4aa8aee..b54e47b7 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -34,7 +34,7 @@ func repoAssignment() macaron.Handler { ) // Check if the user is the same as the repository owner. - if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(userName) { + if ctx.IsLogged && ctx.User.LowerName == strings.ToLower(userName) { owner = ctx.User } else { owner, err = models.GetUserByName(userName) @@ -63,7 +63,7 @@ func repoAssignment() macaron.Handler { return } - if ctx.IsSigned && ctx.User.IsAdmin { + if ctx.IsLogged && ctx.User.IsAdmin { ctx.Repo.AccessMode = models.ACCESS_MODE_OWNER } else { mode, err := models.AccessLevel(ctx.User.ID, repo) @@ -86,7 +86,7 @@ func repoAssignment() macaron.Handler { // Contexter middleware already checks token for user sign in process. func reqToken() macaron.Handler { return func(ctx *context.Context) { - if !ctx.IsSigned { + if !ctx.IsLogged { ctx.Error(401) return } @@ -104,7 +104,7 @@ func reqBasicAuth() macaron.Handler { func reqAdmin() macaron.Handler { return func(ctx *context.Context) { - if !ctx.IsSigned || !ctx.User.IsAdmin { + if !ctx.IsLogged || !ctx.User.IsAdmin { ctx.Error(403) return } diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index e095954a..fdb3e7a5 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -28,7 +28,7 @@ func Search(ctx *context.APIContext) { } // Check visibility. - if ctx.IsSigned && opts.OwnerID > 0 { + if ctx.IsLogged && opts.OwnerID > 0 { if ctx.User.ID == opts.OwnerID { opts.Private = true } else { diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index d797c650..11c3b8bb 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -41,7 +41,7 @@ func Search(ctx *context.APIContext) { AvatarUrl: users[i].AvatarLink(), FullName: users[i].FullName, } - if ctx.IsSigned { + if ctx.IsLogged { results[i].Email = users[i].Email } } @@ -64,7 +64,7 @@ func GetInfo(ctx *context.APIContext) { } // Hide user e-mail when API caller isn't signed in. - if !ctx.IsSigned { + if !ctx.IsLogged { u.Email = "" } ctx.JSON(200, u.APIFormat()) |