aboutsummaryrefslogtreecommitdiffstats
path: root/models/user
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-09-14 14:53:36 +0800
committerGitHub <noreply@github.com>2023-09-14 06:53:36 +0000
commit198a9ca6350954a6d3327a408021fec2bc0fc805 (patch)
treede73b2232ca2474ce9126f52d26298f8eaef3dfd /models/user
parenta457eb94151a718be64d12eff9d9b7eafd6511ad (diff)
downloadgitea-198a9ca6350954a6d3327a408021fec2bc0fc805.tar.gz
gitea-198a9ca6350954a6d3327a408021fec2bc0fc805.zip
Display all user types and org types on admin management UI (#27050)
Follow #24026 <img width="1049" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/d3fc5159-b5e7-411a-b6f8-4a111a027e6b"> --------- Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'models/user')
-rw-r--r--models/user/search.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/models/user/search.go b/models/user/search.go
index bf35fcd9eb..446556f89b 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(