Merge pull request #16580 from stonezdj/22feb24_add_group_name_parameter

Update usergroups API to support search by group_name
This commit is contained in:
stonezdj(Daojun Zhang) 2022-03-30 13:38:37 +08:00 committed by GitHub
commit 8333b19ff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -2768,7 +2768,7 @@ paths:
/usergroups:
get:
summary: Get all user groups information
description: Get all user groups information
description: Get all user groups information, it is open for system admin
operationId: listUserGroups
tags:
- usergroup
@ -2781,6 +2781,11 @@ paths:
type: string
required: false
description: search with ldap group DN
- name: group_name
in: query
type: string
required: false
description: group name need to search, fuzzy matches
responses:
'200':
description: Get user group successfully.

View File

@ -110,6 +110,9 @@ func (u *userGroupAPI) ListUserGroups(ctx context.Context, params operation.List
if err != nil {
return u.SendError(ctx, err)
}
if params.GroupName != nil && len(*params.GroupName) > 0 {
query.Keywords["GroupName"] = &q.FuzzyMatchValue{Value: *params.GroupName}
}
switch authMode {
case common.LDAPAuth:
query.Keywords["GroupType"] = common.LDAPGroupType