mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-03 06:28:06 +01:00
Make the username required when searching user
Make the username required when searching user and remove the support for query email Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
360334991e
commit
83e7213d18
@ -774,20 +774,15 @@ paths:
|
||||
description: Internal errors.
|
||||
/users/search:
|
||||
get:
|
||||
summary: Search users by username, email
|
||||
summary: Search users by username
|
||||
description: |
|
||||
This endpoint is to search the users by username, email.
|
||||
This endpoint is to search the users by username.
|
||||
parameters:
|
||||
- name: username
|
||||
in: query
|
||||
type: string
|
||||
required: false
|
||||
required: true
|
||||
description: Username for filtering results.
|
||||
- name: email
|
||||
in: query
|
||||
type: string
|
||||
required: false
|
||||
description: Email for filtering results.
|
||||
- name: page
|
||||
in: query
|
||||
type: integer
|
||||
|
@ -222,12 +222,15 @@ func (ua *UserAPI) Search() {
|
||||
}
|
||||
query := &models.UserQuery{
|
||||
Username: ua.GetString("username"),
|
||||
Email: ua.GetString("email"),
|
||||
Pagination: &models.Pagination{
|
||||
Page: page,
|
||||
Size: size,
|
||||
},
|
||||
}
|
||||
if len(query.Username) == 0 {
|
||||
ua.SendBadRequestError(errors.New("username is required"))
|
||||
return
|
||||
}
|
||||
|
||||
total, err := dao.GetTotalOfUsers(query)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user