fix
This commit is contained in:
parent
7d9f271b7c
commit
a8cddf020f
@ -11,7 +11,7 @@ import (
|
|||||||
"fusenapi/server/ldap-admin/internal/types"
|
"fusenapi/server/ldap-admin/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetorginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetLdapOrginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
var req types.Request
|
var req types.Request
|
||||||
@ -21,12 +21,12 @@ func GetorginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个业务逻辑层实例
|
// 创建一个业务逻辑层实例
|
||||||
l := logic.NewGetorginationsLogic(r.Context(), svcCtx)
|
l := logic.NewGetLdapOrginationsLogic(r.Context(), svcCtx)
|
||||||
|
|
||||||
rl := reflect.ValueOf(l)
|
rl := reflect.ValueOf(l)
|
||||||
basic.BeforeLogic(w, r, rl)
|
basic.BeforeLogic(w, r, rl)
|
||||||
|
|
||||||
resp := l.Getorginations(&req, userinfo)
|
resp := l.GetLdapOrginations(&req, userinfo)
|
||||||
|
|
||||||
if !basic.AfterLogic(w, r, rl, resp) {
|
if !basic.AfterLogic(w, r, rl, resp) {
|
||||||
basic.NormalAfterLogic(w, r, resp)
|
basic.NormalAfterLogic(w, r, resp)
|
@ -45,7 +45,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
{
|
{
|
||||||
Method: http.MethodGet,
|
Method: http.MethodGet,
|
||||||
Path: "/api/ldap-admin/get_ldap_orginations",
|
Path: "/api/ldap-admin/get_ldap_orginations",
|
||||||
Handler: GetorginationsHandler(serverCtx),
|
Handler: GetLdapOrginationsHandler(serverCtx),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
|
@ -15,14 +15,14 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetorginationsLogic struct {
|
type GetLdapOrginationsLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGetorginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetorginationsLogic {
|
func NewGetLdapOrginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLdapOrginationsLogic {
|
||||||
return &GetorginationsLogic{
|
return &GetLdapOrginationsLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
svcCtx: svcCtx,
|
||||||
@ -30,7 +30,7 @@ func NewGetorginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理进入前逻辑w,r
|
// 处理进入前逻辑w,r
|
||||||
// func (l *GetorginationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
// func (l *GetLdapOrginationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||||
// }
|
// }
|
||||||
type DNItem struct {
|
type DNItem struct {
|
||||||
Attribute map[string]interface{} `json:"attribute"`
|
Attribute map[string]interface{} `json:"attribute"`
|
||||||
@ -40,7 +40,7 @@ type DNItem struct {
|
|||||||
Child []*DNItem `json:"child"`
|
Child []*DNItem `json:"child"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *GetorginationsLogic) Getorginations(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetLdapOrginationsLogic) GetLdapOrginations(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
//从ldap获取组织架构数据
|
//从ldap获取组织架构数据
|
||||||
rootCn := strings.Split(l.svcCtx.Config.Ldap.RootDN, ",")
|
rootCn := strings.Split(l.svcCtx.Config.Ldap.RootDN, ",")
|
||||||
if len(rootCn) == 0 {
|
if len(rootCn) == 0 {
|
||||||
@ -119,6 +119,6 @@ func (l *GetorginationsLogic) Getorginations(req *types.Request, userinfo *auth.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||||
// func (l *GetorginationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
// func (l *GetLdapOrginationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
// }
|
// }
|
@ -31,7 +31,7 @@ service ldap-admin {
|
|||||||
@handler GetMenusHandler
|
@handler GetMenusHandler
|
||||||
get /api/ldap-admin/get_menus(GetMenusReq) returns (response);
|
get /api/ldap-admin/get_menus(GetMenusReq) returns (response);
|
||||||
//获取ldap组织列表
|
//获取ldap组织列表
|
||||||
@handler GetorginationsHandler
|
@handler GetLdapOrginationsHandler
|
||||||
get /api/ldap-admin/get_ldap_orginations(request) returns (response);
|
get /api/ldap-admin/get_ldap_orginations(request) returns (response);
|
||||||
//增加ldap组织
|
//增加ldap组织
|
||||||
@handler CreateLdapOrginationHandler
|
@handler CreateLdapOrginationHandler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user