mirror of
https://github.com/goharbor/harbor
synced 2024-09-21 08:25:48 +00:00
give the username to anonymous when to pull public resource without authN (#11306)
For pull a public resource, there is no need to login, give the access name to anonymous in the audit logs Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
48df949c30
commit
a5c1eae81a
|
@ -168,6 +168,13 @@ func (p *PullArtifactEvent) ResolveToAuditLog() (*model.AuditLog, error) {
|
|||
p.Artifact.RepositoryName, p.Tags[0])
|
||||
}
|
||||
|
||||
// for pull public resource
|
||||
if p.Operator == "" {
|
||||
auditLog.Username = "anonymous"
|
||||
} else {
|
||||
auditLog.Username = p.Operator
|
||||
}
|
||||
|
||||
return auditLog, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user