mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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:
		@@ -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()})
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user