Add actions support to package auth verification (#23729)

Partly fixes https://github.com/go-gitea/gitea/issues/23642

Error info:

![image](https://user-images.githubusercontent.com/18380374/227827027-4280a368-ec9e-49e0-bb93-6b496ada7cd9.png)
ActionsUser (userID -2) is used to login in to docker in action jobs.

Due to we have no permission policy settings of ActionsUser now,
ActionsUser can only access public registry by this quick fix.
This commit is contained in:
yp05327 authored and GitHub committed 2023-04-10 15:21:03 +08:00
1 parent fd9d072af1
commit bb6c670cff
2 files changed
+22 -37

No files matched your search

+2 -5
View File
@@ -30,13 +30,10 @@ func (a *Auth) Verify(req *http.Request, w http.ResponseWriter, store auth.DataS
if uid == 0 {
return nil, nil
}
if uid == -1 {
return user_model.NewGhostUser(), nil
}
u, err := user_model.GetUserByID(req.Context(), uid)
u, err := user_model.GetPossibleUserByID(req.Context(), uid)
if err != nil {
log.Error("GetUserByID: %v", err)
log.Error("GetPossibleUserByID: %v", err)
return nil, err
}