[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
Этот коммит содержится в:
Farhan Munshi
2020-07-16 12:37:26 -04:00
коммит произвёл GitHub
родитель c53c9ed190
Коммит c0bfa58ec1
11 изменённых файлов: 795 добавлений и 116 удалений

Просмотреть файл

@@ -1649,6 +1649,18 @@ func (a *App) GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions)
return stats, nil
}
// GetFilteredUsersStats is used to get a count of users based on the set of filters supported by UserCountOptions.
func (a *App) GetFilteredUsersStats(options *model.UserCountOptions) (*model.UsersStats, *model.AppError) {
count, err := a.Srv().Store.User().Count(*options)
if err != nil {
return nil, err
}
stats := &model.UsersStats{
TotalUsersCount: count,
}
return stats, nil
}
func (a *App) VerifyUserEmail(userId, email string) *model.AppError {
if _, err := a.Srv().Store.User().VerifyEmail(userId, email); err != nil {
return err