mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-04 01:30:15 +01:00
update
This commit is contained in:
parent
6cf545f304
commit
01066c72b5
@ -119,27 +119,29 @@ func (p *ProjectAPI) Post() {
|
||||
return
|
||||
}
|
||||
|
||||
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)
|
||||
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||
}
|
||||
go func() {
|
||||
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)
|
||||
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||
}
|
||||
|
||||
accessLog := models.AccessLog{
|
||||
Username: user.Username,
|
||||
ProjectID: projectID,
|
||||
RepoName: project.Name + "/",
|
||||
RepoTag: "N/A",
|
||||
GUID: "N/A",
|
||||
Operation: "create",
|
||||
OpTime: time.Now(),
|
||||
}
|
||||
if err = dao.AddAccessLog(accessLog); err != nil {
|
||||
log.Errorf("failed to add access log: %v", err)
|
||||
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||
}
|
||||
accessLog := models.AccessLog{
|
||||
Username: user.Username,
|
||||
ProjectID: projectID,
|
||||
RepoName: project.Name + "/",
|
||||
RepoTag: "N/A",
|
||||
GUID: "N/A",
|
||||
Operation: "create",
|
||||
OpTime: time.Now(),
|
||||
}
|
||||
if err = dao.AddAccessLog(accessLog); err != nil {
|
||||
log.Errorf("failed to add access log: %v", err)
|
||||
p.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||
}
|
||||
}()
|
||||
|
||||
p.Redirect(http.StatusCreated, strconv.FormatInt(projectID, 10))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user