Add login name and source id for admin user searching API (#23376)
As title. --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
27494ed20d
commit
6f9cc617fc
4 changed files with 41 additions and 8 deletions
|
@ -22,6 +22,8 @@ type SearchUserOptions struct {
|
|||
Keyword string
|
||||
Type UserType
|
||||
UID int64
|
||||
LoginName string // this option should be used only for admin user
|
||||
SourceID int64 // this option should be used only for admin user
|
||||
OrderBy db.SearchOrderBy
|
||||
Visible []structs.VisibleType
|
||||
Actor *User // The user doing the search
|
||||
|
@ -62,6 +64,13 @@ func (opts *SearchUserOptions) toSearchQueryBase() *xorm.Session {
|
|||
cond = cond.And(builder.Eq{"id": opts.UID})
|
||||
}
|
||||
|
||||
if opts.SourceID > 0 {
|
||||
cond = cond.And(builder.Eq{"login_source": opts.SourceID})
|
||||
}
|
||||
if opts.LoginName != "" {
|
||||
cond = cond.And(builder.Eq{"login_name": opts.LoginName})
|
||||
}
|
||||
|
||||
if !opts.IsActive.IsNone() {
|
||||
cond = cond.And(builder.Eq{"is_active": opts.IsActive.IsTrue()})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue