[MM-28210] sqlstore/user_store: filter deleted users for GetProfilesInChannel (#15390)

* sqlstore/user_store: filter deleted users for GetProfilesInChannel

* allow GetProfilesInChannel use userGetOptions

* sqlstore/user_store: add more test cases

* store/user_store: refine filter
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-09-16 11:04:17 +03:00
коммит произвёл GitHub
родитель 9c272f0b20
Коммит e69a2a41ca
14 изменённых файлов: 229 добавлений и 77 удалений

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

@@ -752,9 +752,9 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if sort == "status" {
profiles, err = c.App.GetUsersInChannelPageByStatus(inChannelId, c.Params.Page, c.Params.PerPage, c.IsSystemAdmin())
profiles, err = c.App.GetUsersInChannelPageByStatus(userGetOptions, c.IsSystemAdmin())
} else {
profiles, err = c.App.GetUsersInChannelPage(inChannelId, c.Params.Page, c.Params.PerPage, c.IsSystemAdmin())
profiles, err = c.App.GetUsersInChannelPage(userGetOptions, c.IsSystemAdmin())
}
} else if len(inGroupId) > 0 {
if c.App.Srv().License() == nil || !*c.App.Srv().License().Features.LDAPGroups {

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

@@ -47,6 +47,7 @@ func localGetUsers(c *Context, w http.ResponseWriter, r *http.Request) {
notInChannelId := r.URL.Query().Get("not_in_channel")
groupConstrained := r.URL.Query().Get("group_constrained")
withoutTeam := r.URL.Query().Get("without_team")
active := r.URL.Query().Get("active")
inactive := r.URL.Query().Get("inactive")
role := r.URL.Query().Get("role")
sort := r.URL.Query().Get("sort")
@@ -74,6 +75,7 @@ func localGetUsers(c *Context, w http.ResponseWriter, r *http.Request) {
withoutTeamBool, _ := strconv.ParseBool(withoutTeam)
groupConstrainedBool, _ := strconv.ParseBool(groupConstrained)
activeBool, _ := strconv.ParseBool(active)
inactiveBool, _ := strconv.ParseBool(inactive)
userGetOptions := &model.UserGetOptions{
@@ -83,6 +85,7 @@ func localGetUsers(c *Context, w http.ResponseWriter, r *http.Request) {
NotInChannelId: notInChannelId,
GroupConstrained: groupConstrainedBool,
WithoutTeam: withoutTeamBool,
Active: activeBool,
Inactive: inactiveBool,
Role: role,
Sort: sort,
@@ -120,9 +123,9 @@ func localGetUsers(c *Context, w http.ResponseWriter, r *http.Request) {
}
} else if len(inChannelId) > 0 {
if sort == "status" {
profiles, err = c.App.GetUsersInChannelPageByStatus(inChannelId, c.Params.Page, c.Params.PerPage, c.IsSystemAdmin())
profiles, err = c.App.GetUsersInChannelPageByStatus(userGetOptions, c.IsSystemAdmin())
} else {
profiles, err = c.App.GetUsersInChannelPage(inChannelId, c.Params.Page, c.Params.PerPage, c.IsSystemAdmin())
profiles, err = c.App.GetUsersInChannelPage(userGetOptions, c.IsSystemAdmin())
}
} else {
profiles, err = c.App.GetUsersPage(userGetOptions, c.IsSystemAdmin())