mirror of
https://github.com/goharbor/harbor
synced 2024-09-21 12:46:13 +00:00
update
This commit is contained in:
parent
6cf545f304
commit
01066c72b5
|
@ -119,27 +119,29 @@ func (p *ProjectAPI) Post() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := dao.GetUser(models.User{
|
go func() {
|
||||||
UserID: p.userID,
|
user, err := dao.GetUser(models.User{
|
||||||
})
|
UserID: p.userID,
|
||||||
if err != nil {
|
})
|
||||||
log.Errorf("failed to get user by ID %d: %v", p.userID, err)
|
if err != nil {
|
||||||
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
log.Errorf("failed to get user by ID %d: %v", p.userID, err)
|
||||||
}
|
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||||
|
}
|
||||||
|
|
||||||
accessLog := models.AccessLog{
|
accessLog := models.AccessLog{
|
||||||
Username: user.Username,
|
Username: user.Username,
|
||||||
ProjectID: projectID,
|
ProjectID: projectID,
|
||||||
RepoName: project.Name + "/",
|
RepoName: project.Name + "/",
|
||||||
RepoTag: "N/A",
|
RepoTag: "N/A",
|
||||||
GUID: "N/A",
|
GUID: "N/A",
|
||||||
Operation: "create",
|
Operation: "create",
|
||||||
OpTime: time.Now(),
|
OpTime: time.Now(),
|
||||||
}
|
}
|
||||||
if err = dao.AddAccessLog(accessLog); err != nil {
|
if err = dao.AddAccessLog(accessLog); err != nil {
|
||||||
log.Errorf("failed to add access log: %v", err)
|
log.Errorf("failed to add access log: %v", err)
|
||||||
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
p.Redirect(http.StatusCreated, strconv.FormatInt(projectID, 10))
|
p.Redirect(http.StatusCreated, strconv.FormatInt(projectID, 10))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user