[MM-26574] Add role filters to get users, users search and add getFilteredUserStats endpoint (#14998)
* MM-26574 Add role filters to user search and get * Add ability to get filtered user stats Add support for include bots * Add tests for user count with filters Add tests * Apply changes from code review * Fix guest filtering * Fix up tests related to guests * Clean role names * Trigger CI * Trigger CI
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c53c9ed190
Коммит
c0bfa58ec1
@@ -364,6 +364,23 @@ func (r *Role) IsValidWithoutId() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func CleanRoleNames(roleNames []string) ([]string, bool) {
|
||||
var cleanedRoleNames []string
|
||||
for _, roleName := range roleNames {
|
||||
if strings.TrimSpace(roleName) == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if !IsValidRoleName(roleName) {
|
||||
return roleNames, false
|
||||
}
|
||||
|
||||
cleanedRoleNames = append(cleanedRoleNames, roleName)
|
||||
}
|
||||
|
||||
return cleanedRoleNames, true
|
||||
}
|
||||
|
||||
func IsValidRoleName(roleName string) bool {
|
||||
if len(roleName) <= 0 || len(roleName) > ROLE_NAME_MAX_LENGTH {
|
||||
return false
|
||||
|
||||
Ссылка в новой задаче
Block a user