aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-03-22 08:03:22 +0100
committerGitHub <noreply@github.com>2022-03-22 15:03:22 +0800
commit80fd25524e13dedbdc3527b32d008de152213a89 (patch)
tree63b2bfe4ffaf1dce12080cabdc2e845c8731a673 /services
parent5495ba7660979973ba19e304786135da474e0e64 (diff)
downloadgitea-80fd25524e13dedbdc3527b32d008de152213a89.tar.gz
gitea-80fd25524e13dedbdc3527b32d008de152213a89.zip
Renamed ctx.User to ctx.Doer. (#19161)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services')
-rw-r--r--services/lfs/locks.go10
-rw-r--r--services/lfs/server.go10
2 files changed, 10 insertions, 10 deletions
diff --git a/services/lfs/locks.go b/services/lfs/locks.go
index 3839119b27..a96e931fd9 100644
--- a/services/lfs/locks.go
+++ b/services/lfs/locks.go
@@ -170,7 +170,7 @@ func PostLockHandler(ctx *context.Context) {
lock, err := models.CreateLFSLock(repository, &models.LFSLock{
Path: req.Path,
- OwnerID: ctx.User.ID,
+ OwnerID: ctx.Doer.ID,
})
if err != nil {
if models.IsErrLFSLockAlreadyExist(err) {
@@ -187,7 +187,7 @@ func PostLockHandler(ctx *context.Context) {
})
return
}
- log.Error("Unable to CreateLFSLock in repository %-v at %s for user %-v: Error: %v", repository, req.Path, ctx.User, err)
+ log.Error("Unable to CreateLFSLock in repository %-v at %s for user %-v: Error: %v", repository, req.Path, ctx.Doer, err)
ctx.JSON(http.StatusInternalServerError, api.LFSLockError{
Message: "internal server error : Internal Server Error",
})
@@ -249,7 +249,7 @@ func VerifyLockHandler(ctx *context.Context) {
lockOursListAPI := make([]*api.LFSLock, 0, len(lockList))
lockTheirsListAPI := make([]*api.LFSLock, 0, len(lockList))
for _, l := range lockList {
- if l.OwnerID == ctx.User.ID {
+ if l.OwnerID == ctx.Doer.ID {
lockOursListAPI = append(lockOursListAPI, convert.ToLFSLock(l))
} else {
lockTheirsListAPI = append(lockTheirsListAPI, convert.ToLFSLock(l))
@@ -301,7 +301,7 @@ func UnLockHandler(ctx *context.Context) {
return
}
- lock, err := models.DeleteLFSLockByID(ctx.ParamsInt64("lid"), repository, ctx.User, req.Force)
+ lock, err := models.DeleteLFSLockByID(ctx.ParamsInt64("lid"), repository, ctx.Doer, req.Force)
if err != nil {
if models.IsErrLFSUnauthorizedAction(err) {
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=gitea-lfs")
@@ -310,7 +310,7 @@ func UnLockHandler(ctx *context.Context) {
})
return
}
- log.Error("Unable to DeleteLFSLockByID[%d] by user %-v with force %t: Error: %v", ctx.ParamsInt64("lid"), ctx.User, req.Force, err)
+ log.Error("Unable to DeleteLFSLockByID[%d] by user %-v with force %t: Error: %v", ctx.ParamsInt64("lid"), ctx.Doer, req.Force, err)
ctx.JSON(http.StatusInternalServerError, api.LFSLockError{
Message: "unable to delete lock : Internal Server Error",
})
diff --git a/services/lfs/server.go b/services/lfs/server.go
index 7c3f88e57b..633aa0a695 100644
--- a/services/lfs/server.go
+++ b/services/lfs/server.go
@@ -222,7 +222,7 @@ func BatchHandler(ctx *context.Context) {
}
if exists && meta == nil {
- accessible, err := models.LFSObjectAccessible(ctx.User, p.Oid)
+ accessible, err := models.LFSObjectAccessible(ctx.Doer, p.Oid)
if err != nil {
log.Error("Unable to check if LFS MetaObject [%s] is accessible. Error: %v", p.Oid, err)
writeStatus(ctx, http.StatusInternalServerError)
@@ -296,7 +296,7 @@ func UploadHandler(ctx *context.Context) {
uploadOrVerify := func() error {
if exists {
- accessible, err := models.LFSObjectAccessible(ctx.User, p.Oid)
+ accessible, err := models.LFSObjectAccessible(ctx.Doer, p.Oid)
if err != nil {
log.Error("Unable to check if LFS MetaObject [%s] is accessible. Error: %v", p.Oid, err)
return err
@@ -488,9 +488,9 @@ func authenticate(ctx *context.Context, repository *repo_model.Repository, autho
}
// ctx.IsSigned is unnecessary here, this will be checked in perm.CanAccess
- perm, err := models.GetUserRepoPermission(repository, ctx.User)
+ perm, err := models.GetUserRepoPermission(repository, ctx.Doer)
if err != nil {
- log.Error("Unable to GetUserRepoPermission for user %-v in repo %-v Error: %v", ctx.User, repository)
+ log.Error("Unable to GetUserRepoPermission for user %-v in repo %-v Error: %v", ctx.Doer, repository)
return false
}
@@ -505,7 +505,7 @@ func authenticate(ctx *context.Context, repository *repo_model.Repository, autho
log.Warn("Authentication failure for provided token with Error: %v", err)
return false
}
- ctx.User = user
+ ctx.Doer = user
return true
}