diff --git a/models/user/search.go b/models/user/search.go index bf35fcd9e..446556f89 100644 --- a/models/user/search.go +++ b/models/user/search.go @@ -34,12 +34,26 @@ type SearchUserOptions struct { IsRestricted util.OptionalBool IsTwoFactorEnabled util.OptionalBool IsProhibitLogin util.OptionalBool + IncludeReserved bool ExtraParamStrings map[string]string } func (opts *SearchUserOptions) toSearchQueryBase() *xorm.Session { - var cond builder.Cond = builder.Eq{"type": opts.Type} + var cond builder.Cond + cond = builder.Eq{"type": opts.Type} + if opts.IncludeReserved { + if opts.Type == UserTypeIndividual { + cond = cond.Or(builder.Eq{"type": UserTypeUserReserved}).Or( + builder.Eq{"type": UserTypeBot}, + ).Or( + builder.Eq{"type": UserTypeRemoteUser}, + ) + } else if opts.Type == UserTypeOrganization { + cond = cond.Or(builder.Eq{"type": UserTypeOrganizationReserved}) + } + } + if len(opts.Keyword) > 0 { lowerKeyword := strings.ToLower(opts.Keyword) keywordCond := builder.Or( diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 39da4be17..ad7d35127 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2780,6 +2780,9 @@ users.full_name = Full Name users.activated = Activated users.admin = Admin users.restricted = Restricted +users.reserved = Reserved +users.bot = Bot +users.remote = Remote users.2fa = 2FA users.repos = Repos users.created = Created diff --git a/routers/web/admin/orgs.go b/routers/web/admin/orgs.go index d0fd0d500..ab44f8048 100644 --- a/routers/web/admin/orgs.go +++ b/routers/web/admin/orgs.go @@ -28,8 +28,9 @@ func Organizations(ctx *context.Context) { } explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{ - Actor: ctx.Doer, - Type: user_model.UserTypeOrganization, + Actor: ctx.Doer, + Type: user_model.UserTypeOrganization, + IncludeReserved: true, // administrator needs to list all acounts include reserved ListOptions: db.ListOptions{ PageSize: setting.UI.Admin.OrgPagingNum, }, diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index 47dff6e85..03ffaf5f3 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -77,6 +77,7 @@ func Users(ctx *context.Context) { IsRestricted: util.OptionalBoolParse(statusFilterMap["is_restricted"]), IsTwoFactorEnabled: util.OptionalBoolParse(statusFilterMap["is_2fa_enabled"]), IsProhibitLogin: util.OptionalBoolParse(statusFilterMap["is_prohibit_login"]), + IncludeReserved: true, // administrator needs to list all acounts include reserved, bot, remote ones ExtraParamStrings: extraParamStrings, }, tplUsers) } diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl index a400dcbc8..ac86e7606 100644 --- a/templates/admin/org/list.tmpl +++ b/templates/admin/org/list.tmpl @@ -37,6 +37,9 @@ {{if .Visibility.IsPrivate}} {{svg "octicon-lock"}} {{end}} + {{if eq .Type 3}}{{/* Reserved organization */}} + {{$.locale.Tr "admin.users.reserved"}} + {{end}} {{.NumTeams}} {{.NumMembers}} diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl index b3e0caa16..733482853 100644 --- a/templates/admin/user/list.tmpl +++ b/templates/admin/user/list.tmpl @@ -84,7 +84,13 @@ {{.Name}} {{if .IsAdmin}} - {{$.locale.Tr "admin.users.admin"}} + {{$.locale.Tr "admin.users.admin"}} + {{else if eq 2 .Type}}{{/* Reserved user */}} + {{$.locale.Tr "admin.users.reserved"}} + {{else if eq 4 .Type}}{{/* Bot "user" */}} + {{$.locale.Tr "admin.users.bot"}} + {{else if eq 5 .Type}}{{/* Remote user */}} + {{$.locale.Tr "admin.users.remote"}} {{end}} {{.Email}}