Skip to content

Commit

Permalink
fix: delete git inner user
Browse files Browse the repository at this point in the history
  • Loading branch information
littlejiancc committed Sep 1, 2021
1 parent 879761c commit afbb1a3
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions modules/gittar/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func doAuth(c *webcontext.Context, repo *models.Repo, repoName string) {
return
}
c.Set("repository", gitRepository)
c.Set("user", models.NewInnerUser())
//c.Set("lock", repoLock.Lock)

//只有在skipAuth范围内,如果读取到了user-id,也触发校验
userIdStr := c.GetHeader("User-Id")
Expand All @@ -224,7 +224,6 @@ func doAuth(c *webcontext.Context, repo *models.Repo, repoName string) {
return
}
c.Set("repository", gitRepository)
//c.Set("lock", repoLock.Lock)
c.Set("user", &models.User{
Name: userInfoDto.Username,
NickName: userInfoDto.NickName,
Expand All @@ -240,20 +239,6 @@ func doAuth(c *webcontext.Context, repo *models.Repo, repoName string) {
}
}

//如果是内置账户不做校验
innerUser, err := GetInnerUser(c)
if err == nil {
gitRepository, err = openRepository(repo)
if err != nil {
c.AbortWithStatus(500, err)
return
}
c.Set("repository", gitRepository)
c.Set("user", innerUser)
c.Next()
return
}

userInfo, err = GetUserInfoByTokenOrBasicAuth(c, repo.ProjectID)
if err == nil {
_, validateError := ValidaUserRepo(c, string(userInfo.ID), repo)
Expand Down

0 comments on commit afbb1a3

Please sign in to comment.