mirror of
https://github.com/go-gitea/gitea
synced 2024-11-16 18:59:25 +01:00
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>
This commit is contained in:
parent
a457eb9415
commit
198a9ca635
@ -34,12 +34,26 @@ type SearchUserOptions struct {
|
|||||||
IsRestricted util.OptionalBool
|
IsRestricted util.OptionalBool
|
||||||
IsTwoFactorEnabled util.OptionalBool
|
IsTwoFactorEnabled util.OptionalBool
|
||||||
IsProhibitLogin util.OptionalBool
|
IsProhibitLogin util.OptionalBool
|
||||||
|
IncludeReserved bool
|
||||||
|
|
||||||
ExtraParamStrings map[string]string
|
ExtraParamStrings map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opts *SearchUserOptions) toSearchQueryBase() *xorm.Session {
|
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 {
|
if len(opts.Keyword) > 0 {
|
||||||
lowerKeyword := strings.ToLower(opts.Keyword)
|
lowerKeyword := strings.ToLower(opts.Keyword)
|
||||||
keywordCond := builder.Or(
|
keywordCond := builder.Or(
|
||||||
|
@ -2780,6 +2780,9 @@ users.full_name = Full Name
|
|||||||
users.activated = Activated
|
users.activated = Activated
|
||||||
users.admin = Admin
|
users.admin = Admin
|
||||||
users.restricted = Restricted
|
users.restricted = Restricted
|
||||||
|
users.reserved = Reserved
|
||||||
|
users.bot = Bot
|
||||||
|
users.remote = Remote
|
||||||
users.2fa = 2FA
|
users.2fa = 2FA
|
||||||
users.repos = Repos
|
users.repos = Repos
|
||||||
users.created = Created
|
users.created = Created
|
||||||
|
@ -28,8 +28,9 @@ func Organizations(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
||||||
Actor: ctx.Doer,
|
Actor: ctx.Doer,
|
||||||
Type: user_model.UserTypeOrganization,
|
Type: user_model.UserTypeOrganization,
|
||||||
|
IncludeReserved: true, // administrator needs to list all acounts include reserved
|
||||||
ListOptions: db.ListOptions{
|
ListOptions: db.ListOptions{
|
||||||
PageSize: setting.UI.Admin.OrgPagingNum,
|
PageSize: setting.UI.Admin.OrgPagingNum,
|
||||||
},
|
},
|
||||||
|
@ -77,6 +77,7 @@ func Users(ctx *context.Context) {
|
|||||||
IsRestricted: util.OptionalBoolParse(statusFilterMap["is_restricted"]),
|
IsRestricted: util.OptionalBoolParse(statusFilterMap["is_restricted"]),
|
||||||
IsTwoFactorEnabled: util.OptionalBoolParse(statusFilterMap["is_2fa_enabled"]),
|
IsTwoFactorEnabled: util.OptionalBoolParse(statusFilterMap["is_2fa_enabled"]),
|
||||||
IsProhibitLogin: util.OptionalBoolParse(statusFilterMap["is_prohibit_login"]),
|
IsProhibitLogin: util.OptionalBoolParse(statusFilterMap["is_prohibit_login"]),
|
||||||
|
IncludeReserved: true, // administrator needs to list all acounts include reserved, bot, remote ones
|
||||||
ExtraParamStrings: extraParamStrings,
|
ExtraParamStrings: extraParamStrings,
|
||||||
}, tplUsers)
|
}, tplUsers)
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
{{if .Visibility.IsPrivate}}
|
{{if .Visibility.IsPrivate}}
|
||||||
<span class="text gold">{{svg "octicon-lock"}}</span>
|
<span class="text gold">{{svg "octicon-lock"}}</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if eq .Type 3}}{{/* Reserved organization */}}
|
||||||
|
<span class="ui mini label">{{$.locale.Tr "admin.users.reserved"}}</span>
|
||||||
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
<td>{{.NumTeams}}</td>
|
<td>{{.NumTeams}}</td>
|
||||||
<td>{{.NumMembers}}</td>
|
<td>{{.NumMembers}}</td>
|
||||||
|
@ -84,7 +84,13 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href="{{$.Link}}/{{.ID}}">{{.Name}}</a>
|
<a href="{{$.Link}}/{{.ID}}">{{.Name}}</a>
|
||||||
{{if .IsAdmin}}
|
{{if .IsAdmin}}
|
||||||
<span class="ui basic label">{{$.locale.Tr "admin.users.admin"}}</span>
|
<span class="ui mini label">{{$.locale.Tr "admin.users.admin"}}</span>
|
||||||
|
{{else if eq 2 .Type}}{{/* Reserved user */}}
|
||||||
|
<span class="ui mini label">{{$.locale.Tr "admin.users.reserved"}}</span>
|
||||||
|
{{else if eq 4 .Type}}{{/* Bot "user" */}}
|
||||||
|
<span class="ui mini label">{{$.locale.Tr "admin.users.bot"}}</span>
|
||||||
|
{{else if eq 5 .Type}}{{/* Remote user */}}
|
||||||
|
<span class="ui mini label">{{$.locale.Tr "admin.users.remote"}}</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
<td class="gt-ellipsis gt-max-width-12rem">{{.Email}}</td>
|
<td class="gt-ellipsis gt-max-width-12rem">{{.Email}}</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user