MM-17383: Update query to include users who are not members of any gr… (#11730)

* MM-17383: Update query to include users who are not members of any groups.

* MM-17383: Fixes govet complaint.

* MM-17383: Sorts by username.

* MM-17383: Removes accidental staging.
Этот коммит содержится в:
Martin Kraft
2019-07-30 12:04:08 -04:00
коммит произвёл GitHub
родитель f44473e062
Коммит ddc48c3ac1
4 изменённых файлов: 82 добавлений и 56 удалений

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

@@ -783,13 +783,24 @@ func IsValidLocale(locale string) bool {
type UserWithGroups struct {
User
GroupIDs string `json:"-"`
GroupIDs *string `json:"-"`
Groups []*Group `json:"groups"`
SchemeGuest bool `json:"scheme_guest"`
SchemeUser bool `json:"scheme_user"`
SchemeAdmin bool `json:"scheme_admin"`
}
func (u *UserWithGroups) GetGroupIDs() []string {
if u.GroupIDs == nil {
return nil
}
trimmed := strings.TrimSpace(*u.GroupIDs)
if len(trimmed) == 0 {
return nil
}
return strings.Split(trimmed, ",")
}
type UsersWithGroupsAndCount struct {
Users []*UserWithGroups `json:"users"`
Count int64 `json:"total_count"`