From a666829a37be6f9fd98f9e7dd1767c420f7f3b32 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 24 Nov 2021 17:49:20 +0800 Subject: Move user related model into models/user (#17781) * Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge --- services/lfs/server.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'services/lfs/server.go') diff --git a/services/lfs/server.go b/services/lfs/server.go index 7887658816..28756e4f19 100644 --- a/services/lfs/server.go +++ b/services/lfs/server.go @@ -20,6 +20,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/unit" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/json" lfs_module "code.gitea.io/gitea/modules/lfs" @@ -506,7 +507,7 @@ func authenticate(ctx *context.Context, repository *models.Repository, authoriza return true } -func handleLFSToken(tokenSHA string, target *models.Repository, mode models.AccessMode) (*models.User, error) { +func handleLFSToken(tokenSHA string, target *models.Repository, mode models.AccessMode) (*user_model.User, error) { if !strings.Contains(tokenSHA, ".") { return nil, nil } @@ -533,7 +534,7 @@ func handleLFSToken(tokenSHA string, target *models.Repository, mode models.Acce return nil, fmt.Errorf("invalid token claim") } - u, err := models.GetUserByID(claims.UserID) + u, err := user_model.GetUserByID(claims.UserID) if err != nil { log.Error("Unable to GetUserById[%d]: Error: %v", claims.UserID, err) return nil, err @@ -541,7 +542,7 @@ func handleLFSToken(tokenSHA string, target *models.Repository, mode models.Acce return u, nil } -func parseToken(authorization string, target *models.Repository, mode models.AccessMode) (*models.User, error) { +func parseToken(authorization string, target *models.Repository, mode models.AccessMode) (*user_model.User, error) { if authorization == "" { return nil, fmt.Errorf("no token") } -- cgit v1.2.3