MM-16477 Add api to get users modified since a given time (#11406)

* MM-16477 Add api to get users modified since a given time

* Address feedback
Этот коммит содержится в:
Harrison Healey
2019-06-27 09:37:03 -04:00
коммит произвёл GitHub
родитель 89a41dc381
Коммит 4b96437370
12 изменённых файлов: 176 добавлений и 47 удалений

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

@@ -15,6 +15,7 @@ import (
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/store"
"github.com/mattermost/mattermost-server/utils"
)
@@ -615,13 +616,29 @@ func getUsersByIds(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
sinceString := r.URL.Query().Get("since")
options := &store.UserGetByIdsOpts{
IsAdmin: c.IsSystemAdmin(),
}
if len(sinceString) > 0 {
since, parseError := strconv.ParseInt(sinceString, 10, 64)
if parseError != nil {
c.SetInvalidParam("since")
return
}
options.Since = since
}
restrictions, err := c.App.GetViewUsersRestrictions(c.App.Session.UserId)
if err != nil {
c.Err = err
return
}
options.ViewRestrictions = restrictions
users, err := c.App.GetUsersByIds(userIds, c.IsSystemAdmin(), restrictions)
users, err := c.App.GetUsersByIds(userIds, options)
if err != nil {
c.Err = err
return