mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
						||
 | 
						||
package acme
 | 
						||
 | 
						||
import (
 | 
						||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
						||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
						||
	"github.com/iwind/TeaGo/maps"
 | 
						||
)
 | 
						||
 | 
						||
type UserOptionsAction struct {
 | 
						||
	actionutils.ParentAction
 | 
						||
}
 | 
						||
 | 
						||
func (this *UserOptionsAction) RunPost(params struct {
 | 
						||
	PlatformUserId int64
 | 
						||
}) {
 | 
						||
	// 获取所有可用的用户
 | 
						||
	usersResp, err := this.RPC().ACMEUserRPC().FindAllACMEUsers(this.AdminContext(), &pb.FindAllACMEUsersRequest{
 | 
						||
		AdminId: 0,
 | 
						||
		UserId:  params.PlatformUserId,
 | 
						||
	})
 | 
						||
	if err != nil {
 | 
						||
		this.ErrorPage(err)
 | 
						||
		return
 | 
						||
	}
 | 
						||
	var userMaps = []maps.Map{}
 | 
						||
	for _, user := range usersResp.AcmeUsers {
 | 
						||
		description := user.Description
 | 
						||
		if len(description) > 0 {
 | 
						||
			description = "(" + description + ")"
 | 
						||
		}
 | 
						||
 | 
						||
		userMaps = append(userMaps, maps.Map{
 | 
						||
			"id":           user.Id,
 | 
						||
			"description":  description,
 | 
						||
			"email":        user.Email,
 | 
						||
			"providerCode": user.AcmeProviderCode,
 | 
						||
		})
 | 
						||
	}
 | 
						||
	this.Data["users"] = userMaps
 | 
						||
 | 
						||
	this.Success()
 | 
						||
}
 |