mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 22:57:38 +01:00
Check whether user is nil in Prepare() of users API (#7507)
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
parent
2a463016a9
commit
80176cc354
@ -102,6 +102,12 @@ func (ua *UserAPI) Prepare() {
|
||||
return
|
||||
}
|
||||
|
||||
if user == nil {
|
||||
log.Errorf("User with username %s does not exist in DB.", ua.SecurityCtx.GetUsername())
|
||||
ua.SendInternalServerError(fmt.Errorf("user %s does not exist in DB", ua.SecurityCtx.GetUsername()))
|
||||
return
|
||||
}
|
||||
|
||||
ua.currentUserID = user.UserID
|
||||
id := ua.Ctx.Input.Param(":id")
|
||||
if id == "current" {
|
||||
|
Loading…
Reference in New Issue
Block a user