From 0bec257730ccd6a475e79e06345f3e2dc02c7748 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 17 Nov 2023 10:22:23 +0800 Subject: [PATCH 1/2] fix --- .../handler/addldaporginationmemberhandler.go | 35 +++++++++++++ .../removeldaporginationmemberhandler.go | 35 +++++++++++++ server/ldap-admin/internal/handler/routes.go | 10 ++++ .../logic/addldaporginationmemberlogic.go | 50 +++++++++++++++++++ .../logic/removeldaporginationmemberlogic.go | 43 ++++++++++++++++ server/ldap-admin/internal/types/types.go | 10 ++++ server_api/ldap-admin.api | 16 ++++++ utils/ldap_lib/ldap_group.go | 6 +-- 8 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 server/ldap-admin/internal/handler/addldaporginationmemberhandler.go create mode 100644 server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go create mode 100644 server/ldap-admin/internal/logic/addldaporginationmemberlogic.go create mode 100644 server/ldap-admin/internal/logic/removeldaporginationmemberlogic.go diff --git a/server/ldap-admin/internal/handler/addldaporginationmemberhandler.go b/server/ldap-admin/internal/handler/addldaporginationmemberhandler.go new file mode 100644 index 00000000..76ccb71c --- /dev/null +++ b/server/ldap-admin/internal/handler/addldaporginationmemberhandler.go @@ -0,0 +1,35 @@ +package handler + +import ( + "net/http" + "reflect" + + "fusenapi/utils/basic" + + "fusenapi/server/ldap-admin/internal/logic" + "fusenapi/server/ldap-admin/internal/svc" + "fusenapi/server/ldap-admin/internal/types" +) + +func AddLdapOrginationMemberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + + var req types.AddLdapOrginationMemberReq + userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + if err != nil { + return + } + + // 创建一个业务逻辑层实例 + l := logic.NewAddLdapOrginationMemberLogic(r.Context(), svcCtx) + + rl := reflect.ValueOf(l) + basic.BeforeLogic(w, r, rl) + + resp := l.AddLdapOrginationMember(&req, userinfo) + + if !basic.AfterLogic(w, r, rl, resp) { + basic.NormalAfterLogic(w, r, resp) + } + } +} diff --git a/server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go b/server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go new file mode 100644 index 00000000..4e3a9ded --- /dev/null +++ b/server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go @@ -0,0 +1,35 @@ +package handler + +import ( + "net/http" + "reflect" + + "fusenapi/utils/basic" + + "fusenapi/server/ldap-admin/internal/logic" + "fusenapi/server/ldap-admin/internal/svc" + "fusenapi/server/ldap-admin/internal/types" +) + +func RemoveLdapOrginationMemberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + + var req types.RemoveLdapOrginationMemberReq + userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + if err != nil { + return + } + + // 创建一个业务逻辑层实例 + l := logic.NewRemoveLdapOrginationMemberLogic(r.Context(), svcCtx) + + rl := reflect.ValueOf(l) + basic.BeforeLogic(w, r, rl) + + resp := l.RemoveLdapOrginationMember(&req, userinfo) + + if !basic.AfterLogic(w, r, rl, resp) { + basic.NormalAfterLogic(w, r, resp) + } + } +} diff --git a/server/ldap-admin/internal/handler/routes.go b/server/ldap-admin/internal/handler/routes.go index f17e1a45..773f3cd1 100644 --- a/server/ldap-admin/internal/handler/routes.go +++ b/server/ldap-admin/internal/handler/routes.go @@ -82,6 +82,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/api/ldap-admin/get_ldap_user_info", Handler: GetLdapUserInfoHandler(serverCtx), }, + { + Method: http.MethodPost, + Path: "/api/ldap-admin/add_ldap_orgination_member", + Handler: AddLdapOrginationMemberHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/api/ldap-admin/remove_ldap_orgination_member", + Handler: RemoveLdapOrginationMemberHandler(serverCtx), + }, }, ) } diff --git a/server/ldap-admin/internal/logic/addldaporginationmemberlogic.go b/server/ldap-admin/internal/logic/addldaporginationmemberlogic.go new file mode 100644 index 00000000..72efb73a --- /dev/null +++ b/server/ldap-admin/internal/logic/addldaporginationmemberlogic.go @@ -0,0 +1,50 @@ +package logic + +import ( + "fusenapi/utils/auth" + "fusenapi/utils/basic" + "strings" + + "context" + + "fusenapi/server/ldap-admin/internal/svc" + "fusenapi/server/ldap-admin/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type AddLdapOrginationMemberLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewAddLdapOrginationMemberLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddLdapOrginationMemberLogic { + return &AddLdapOrginationMemberLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +// 处理进入前逻辑w,r +// func (l *AddLdapOrginationMemberLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// } + +func (l *AddLdapOrginationMemberLogic) AddLdapOrginationMember(req *types.AddLdapOrginationMemberReq, userinfo *auth.UserInfo) (resp *basic.Response) { + req.OrginationDN = strings.Trim(req.OrginationDN, " ") + req.UserDN = strings.Trim(req.UserDN, " ") + if len(req.OrginationDN) <= 3 || req.OrginationDN[:3] != "ou=" { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "无效的目标组织DN") + } + if len(req.UserDN) <= 3 || req.UserDN[:3] != "cn=" { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "无效的用户DN") + } + //ldapServer := ldap_lib.NewLdap(l.svcCtx.Ldap, l.svcCtx.Config.Ldap.BaseDN, l.svcCtx.Config.Ldap.RootDN) + return resp.SetStatus(basic.CodeOK) +} + +// 处理逻辑后 w,r 如:重定向, resp 必须重新处理 +// func (l *AddLdapOrginationMemberLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// // httpx.OkJsonCtx(r.Context(), w, resp) +// } diff --git a/server/ldap-admin/internal/logic/removeldaporginationmemberlogic.go b/server/ldap-admin/internal/logic/removeldaporginationmemberlogic.go new file mode 100644 index 00000000..7d6e0f5e --- /dev/null +++ b/server/ldap-admin/internal/logic/removeldaporginationmemberlogic.go @@ -0,0 +1,43 @@ +package logic + +import ( + "fusenapi/utils/auth" + "fusenapi/utils/basic" + + "context" + + "fusenapi/server/ldap-admin/internal/svc" + "fusenapi/server/ldap-admin/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type RemoveLdapOrginationMemberLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewRemoveLdapOrginationMemberLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RemoveLdapOrginationMemberLogic { + return &RemoveLdapOrginationMemberLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +// 处理进入前逻辑w,r +// func (l *RemoveLdapOrginationMemberLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// } + +func (l *RemoveLdapOrginationMemberLogic) RemoveLdapOrginationMember(req *types.RemoveLdapOrginationMemberReq, userinfo *auth.UserInfo) (resp *basic.Response) { + // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) + // userinfo 传入值时, 一定不为null + + return resp.SetStatus(basic.CodeOK) +} + +// 处理逻辑后 w,r 如:重定向, resp 必须重新处理 +// func (l *RemoveLdapOrginationMemberLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// // httpx.OkJsonCtx(r.Context(), w, resp) +// } diff --git a/server/ldap-admin/internal/types/types.go b/server/ldap-admin/internal/types/types.go index 431f6ece..758a9c98 100644 --- a/server/ldap-admin/internal/types/types.go +++ b/server/ldap-admin/internal/types/types.go @@ -124,6 +124,16 @@ type GetLdapUserInfoRsp struct { Status int64 `json:"status,options=0|1"` //状态 1正常0离职 } +type AddLdapOrginationMemberReq struct { + OrginationDN string `json:"orgination_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN +} + +type RemoveLdapOrginationMemberReq struct { + OrginationDN string `json:"orgination_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN +} + type Request struct { } diff --git a/server_api/ldap-admin.api b/server_api/ldap-admin.api index 621bfce9..e1842022 100644 --- a/server_api/ldap-admin.api +++ b/server_api/ldap-admin.api @@ -54,6 +54,12 @@ service ldap-admin { //获取ldap用户信息 @handler GetLdapUserInfoHandler get /api/ldap-admin/get_ldap_user_info(GetLdapUserInfoReq) returns (response); + //ldap组织添加成员 + @handler AddLdapOrginationMemberHandler + post /api/ldap-admin/add_ldap_orgination_member(AddLdapOrginationMemberReq) returns (response); + //ldap组织移除成员 + @handler RemoveLdapOrginationMemberHandler + post /api/ldap-admin/remove_ldap_orgination_member(RemoveLdapOrginationMemberReq) returns (response); } type GetApisReq { @@ -170,4 +176,14 @@ type GetLdapUserInfoRsp { Mobile string `json:"mobile"` //手机号 Avatar string `json:"avatar"` //头像地址 Status int64 `json:"status,options=0|1"` //状态 1正常0离职 +} +//ldap组织添加成员 +type AddLdapOrginationMemberReq { + OrginationDN string `json:"orgination_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN +} +//ldap组织移除成员 +type RemoveLdapOrginationMemberReq { + OrginationDN string `json:"orgination_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN } \ No newline at end of file diff --git a/utils/ldap_lib/ldap_group.go b/utils/ldap_lib/ldap_group.go index f7290759..922cc303 100644 --- a/utils/ldap_lib/ldap_group.go +++ b/utils/ldap_lib/ldap_group.go @@ -65,8 +65,8 @@ func (l *Ldap) Search(DN string, scope int, filter string, attr []string, contro return l.conn.Search(searchRequest) } -// AddUserToGroup 添加用户到分组 -func (l *Ldap) AddUserToGroup(groupDN, userDN string) error { +// AddUserToGroup 添加用户到组织 +func (l *Ldap) AddUserToOrganization(groupDN, userDN string) error { //判断dn是否以ou开头 if groupDN[:3] == "ou=" { return errors.New("不能添加用户到OU组织单元") @@ -77,7 +77,7 @@ func (l *Ldap) AddUserToGroup(groupDN, userDN string) error { } // DelUserFromGroup 将用户从分组删除 -func (l *Ldap) RemoveUserFromGroup(groupDN, userDN string) error { +func (l *Ldap) RemoveUserFromOrganization(groupDN, userDN string) error { modify := ldap.NewModifyRequest(groupDN, nil) modify.Delete("uniqueMember", []string{userDN}) return l.conn.Modify(modify) From a340da2359955427a397765ce3674f6ea22e1c4c Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 17 Nov 2023 10:33:40 +0800 Subject: [PATCH 2/2] fix --- ...go => addldaporganizationmemberhandler.go} | 8 +-- ...er.go => createldaporganizationhandler.go} | 8 +-- ...er.go => deleteldaporganizationhandler.go} | 8 +-- ...dler.go => getldaporganizationshandler.go} | 6 +-- .../removeldaporganizationmemberhandler.go | 35 +++++++++++++ .../removeldaporginationmemberhandler.go | 35 ------------- server/ldap-admin/internal/handler/routes.go | 24 ++++----- ...er.go => updateldaporganizationhandler.go} | 8 +-- ...c.go => addldaporganizationmemberlogic.go} | 16 +++--- ...ogic.go => createldaporganizationlogic.go} | 26 +++++----- ...ogic.go => deleteldaporganizationlogic.go} | 21 ++++---- ...slogic.go => getldaporganizationslogic.go} | 12 ++--- ...o => removeldaporganizationmemberlogic.go} | 12 ++--- ...ogic.go => updateldaporganizationlogic.go} | 20 +++---- server/ldap-admin/internal/types/types.go | 28 +++++----- server_api/ldap-admin.api | 52 +++++++++---------- 16 files changed, 158 insertions(+), 161 deletions(-) rename server/ldap-admin/internal/handler/{addldaporginationmemberhandler.go => addldaporganizationmemberhandler.go} (68%) rename server/ldap-admin/internal/handler/{updateldaporginationhandler.go => createldaporganizationhandler.go} (69%) rename server/ldap-admin/internal/handler/{createldaporginationhandler.go => deleteldaporganizationhandler.go} (69%) rename server/ldap-admin/internal/handler/{getldaporginationshandler.go => getldaporganizationshandler.go} (74%) create mode 100644 server/ldap-admin/internal/handler/removeldaporganizationmemberhandler.go delete mode 100644 server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go rename server/ldap-admin/internal/handler/{deleteldaporginationhandler.go => updateldaporganizationhandler.go} (69%) rename server/ldap-admin/internal/logic/{addldaporginationmemberlogic.go => addldaporganizationmemberlogic.go} (56%) rename server/ldap-admin/internal/logic/{createldaporginationlogic.go => createldaporganizationlogic.go} (64%) rename server/ldap-admin/internal/logic/{deleteldaporginationlogic.go => deleteldaporganizationlogic.go} (52%) rename server/ldap-admin/internal/logic/{getldaporginationslogic.go => getldaporganizationslogic.go} (86%) rename server/ldap-admin/internal/logic/{removeldaporginationmemberlogic.go => removeldaporganizationmemberlogic.go} (53%) rename server/ldap-admin/internal/logic/{updateldaporginationlogic.go => updateldaporganizationlogic.go} (58%) diff --git a/server/ldap-admin/internal/handler/addldaporginationmemberhandler.go b/server/ldap-admin/internal/handler/addldaporganizationmemberhandler.go similarity index 68% rename from server/ldap-admin/internal/handler/addldaporginationmemberhandler.go rename to server/ldap-admin/internal/handler/addldaporganizationmemberhandler.go index 76ccb71c..36830cba 100644 --- a/server/ldap-admin/internal/handler/addldaporginationmemberhandler.go +++ b/server/ldap-admin/internal/handler/addldaporganizationmemberhandler.go @@ -11,22 +11,22 @@ import ( "fusenapi/server/ldap-admin/internal/types" ) -func AddLdapOrginationMemberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { +func AddLdapOrganizationMemberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req types.AddLdapOrginationMemberReq + var req types.AddLdapOrganizationMemberReq userinfo, err := basic.RequestParse(w, r, svcCtx, &req) if err != nil { return } // 创建一个业务逻辑层实例 - l := logic.NewAddLdapOrginationMemberLogic(r.Context(), svcCtx) + l := logic.NewAddLdapOrganizationMemberLogic(r.Context(), svcCtx) rl := reflect.ValueOf(l) basic.BeforeLogic(w, r, rl) - resp := l.AddLdapOrginationMember(&req, userinfo) + resp := l.AddLdapOrganizationMember(&req, userinfo) if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) diff --git a/server/ldap-admin/internal/handler/updateldaporginationhandler.go b/server/ldap-admin/internal/handler/createldaporganizationhandler.go similarity index 69% rename from server/ldap-admin/internal/handler/updateldaporginationhandler.go rename to server/ldap-admin/internal/handler/createldaporganizationhandler.go index 31e9a88b..fcfe86f6 100644 --- a/server/ldap-admin/internal/handler/updateldaporginationhandler.go +++ b/server/ldap-admin/internal/handler/createldaporganizationhandler.go @@ -11,22 +11,22 @@ import ( "fusenapi/server/ldap-admin/internal/types" ) -func UpdateLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { +func CreateLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateLdapOrginationReq + var req types.CreateLdapOrganizationReq userinfo, err := basic.RequestParse(w, r, svcCtx, &req) if err != nil { return } // 创建一个业务逻辑层实例 - l := logic.NewUpdateLdapOrginationLogic(r.Context(), svcCtx) + l := logic.NewCreateLdapOrganizationLogic(r.Context(), svcCtx) rl := reflect.ValueOf(l) basic.BeforeLogic(w, r, rl) - resp := l.UpdateLdapOrgination(&req, userinfo) + resp := l.CreateLdapOrganization(&req, userinfo) if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) diff --git a/server/ldap-admin/internal/handler/createldaporginationhandler.go b/server/ldap-admin/internal/handler/deleteldaporganizationhandler.go similarity index 69% rename from server/ldap-admin/internal/handler/createldaporginationhandler.go rename to server/ldap-admin/internal/handler/deleteldaporganizationhandler.go index a0954734..b209a1a6 100644 --- a/server/ldap-admin/internal/handler/createldaporginationhandler.go +++ b/server/ldap-admin/internal/handler/deleteldaporganizationhandler.go @@ -11,22 +11,22 @@ import ( "fusenapi/server/ldap-admin/internal/types" ) -func CreateLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { +func DeleteLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateLdapOrginationReq + var req types.DeleteLdapOrganizationReq userinfo, err := basic.RequestParse(w, r, svcCtx, &req) if err != nil { return } // 创建一个业务逻辑层实例 - l := logic.NewCreateLdapOrginationLogic(r.Context(), svcCtx) + l := logic.NewDeleteLdapOrganizationLogic(r.Context(), svcCtx) rl := reflect.ValueOf(l) basic.BeforeLogic(w, r, rl) - resp := l.CreateLdapOrgination(&req, userinfo) + resp := l.DeleteLdapOrganization(&req, userinfo) if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) diff --git a/server/ldap-admin/internal/handler/getldaporginationshandler.go b/server/ldap-admin/internal/handler/getldaporganizationshandler.go similarity index 74% rename from server/ldap-admin/internal/handler/getldaporginationshandler.go rename to server/ldap-admin/internal/handler/getldaporganizationshandler.go index 0ba2eb2a..b98edbd4 100644 --- a/server/ldap-admin/internal/handler/getldaporginationshandler.go +++ b/server/ldap-admin/internal/handler/getldaporganizationshandler.go @@ -11,7 +11,7 @@ import ( "fusenapi/server/ldap-admin/internal/types" ) -func GetLdapOrginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { +func GetLdapOrganizationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.Request @@ -21,12 +21,12 @@ func GetLdapOrginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { } // 创建一个业务逻辑层实例 - l := logic.NewGetLdapOrginationsLogic(r.Context(), svcCtx) + l := logic.NewGetLdapOrganizationsLogic(r.Context(), svcCtx) rl := reflect.ValueOf(l) basic.BeforeLogic(w, r, rl) - resp := l.GetLdapOrginations(&req, userinfo) + resp := l.GetLdapOrganizations(&req, userinfo) if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) diff --git a/server/ldap-admin/internal/handler/removeldaporganizationmemberhandler.go b/server/ldap-admin/internal/handler/removeldaporganizationmemberhandler.go new file mode 100644 index 00000000..43d70aab --- /dev/null +++ b/server/ldap-admin/internal/handler/removeldaporganizationmemberhandler.go @@ -0,0 +1,35 @@ +package handler + +import ( + "net/http" + "reflect" + + "fusenapi/utils/basic" + + "fusenapi/server/ldap-admin/internal/logic" + "fusenapi/server/ldap-admin/internal/svc" + "fusenapi/server/ldap-admin/internal/types" +) + +func RemoveLdapOrganizationMemberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + + var req types.RemoveLdapOrganizationMemberReq + userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + if err != nil { + return + } + + // 创建一个业务逻辑层实例 + l := logic.NewRemoveLdapOrganizationMemberLogic(r.Context(), svcCtx) + + rl := reflect.ValueOf(l) + basic.BeforeLogic(w, r, rl) + + resp := l.RemoveLdapOrganizationMember(&req, userinfo) + + if !basic.AfterLogic(w, r, rl, resp) { + basic.NormalAfterLogic(w, r, resp) + } + } +} diff --git a/server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go b/server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go deleted file mode 100644 index 4e3a9ded..00000000 --- a/server/ldap-admin/internal/handler/removeldaporginationmemberhandler.go +++ /dev/null @@ -1,35 +0,0 @@ -package handler - -import ( - "net/http" - "reflect" - - "fusenapi/utils/basic" - - "fusenapi/server/ldap-admin/internal/logic" - "fusenapi/server/ldap-admin/internal/svc" - "fusenapi/server/ldap-admin/internal/types" -) - -func RemoveLdapOrginationMemberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - - var req types.RemoveLdapOrginationMemberReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) - if err != nil { - return - } - - // 创建一个业务逻辑层实例 - l := logic.NewRemoveLdapOrginationMemberLogic(r.Context(), svcCtx) - - rl := reflect.ValueOf(l) - basic.BeforeLogic(w, r, rl) - - resp := l.RemoveLdapOrginationMember(&req, userinfo) - - if !basic.AfterLogic(w, r, rl, resp) { - basic.NormalAfterLogic(w, r, resp) - } - } -} diff --git a/server/ldap-admin/internal/handler/routes.go b/server/ldap-admin/internal/handler/routes.go index 773f3cd1..cc2d93ae 100644 --- a/server/ldap-admin/internal/handler/routes.go +++ b/server/ldap-admin/internal/handler/routes.go @@ -44,23 +44,23 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { Method: http.MethodGet, - Path: "/api/ldap-admin/get_ldap_orginations", - Handler: GetLdapOrginationsHandler(serverCtx), + Path: "/api/ldap-admin/get_ldap_organizations", + Handler: GetLdapOrganizationsHandler(serverCtx), }, { Method: http.MethodPost, - Path: "/api/ldap-admin/create_ldap_orgination", - Handler: CreateLdapOrginationHandler(serverCtx), + Path: "/api/ldap-admin/create_ldap_organization", + Handler: CreateLdapOrganizationHandler(serverCtx), }, { Method: http.MethodPost, - Path: "/api/ldap-admin/delete_ldap_orgination", - Handler: DeleteLdapOrginationHandler(serverCtx), + Path: "/api/ldap-admin/delete_ldap_organization", + Handler: DeleteLdapOrganizationHandler(serverCtx), }, { Method: http.MethodPost, - Path: "/api/ldap-admin/update_ldap_orgination", - Handler: UpdateLdapOrginationHandler(serverCtx), + Path: "/api/ldap-admin/update_ldap_organization", + Handler: UpdateLdapOrganizationHandler(serverCtx), }, { Method: http.MethodPost, @@ -84,13 +84,13 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { Method: http.MethodPost, - Path: "/api/ldap-admin/add_ldap_orgination_member", - Handler: AddLdapOrginationMemberHandler(serverCtx), + Path: "/api/ldap-admin/add_ldap_organization_member", + Handler: AddLdapOrganizationMemberHandler(serverCtx), }, { Method: http.MethodPost, - Path: "/api/ldap-admin/remove_ldap_orgination_member", - Handler: RemoveLdapOrginationMemberHandler(serverCtx), + Path: "/api/ldap-admin/remove_ldap_organization_member", + Handler: RemoveLdapOrganizationMemberHandler(serverCtx), }, }, ) diff --git a/server/ldap-admin/internal/handler/deleteldaporginationhandler.go b/server/ldap-admin/internal/handler/updateldaporganizationhandler.go similarity index 69% rename from server/ldap-admin/internal/handler/deleteldaporginationhandler.go rename to server/ldap-admin/internal/handler/updateldaporganizationhandler.go index 93fd0d0f..8a9846a6 100644 --- a/server/ldap-admin/internal/handler/deleteldaporginationhandler.go +++ b/server/ldap-admin/internal/handler/updateldaporganizationhandler.go @@ -11,22 +11,22 @@ import ( "fusenapi/server/ldap-admin/internal/types" ) -func DeleteLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { +func UpdateLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteLdapOrginationReq + var req types.UpdateLdapOrganizationReq userinfo, err := basic.RequestParse(w, r, svcCtx, &req) if err != nil { return } // 创建一个业务逻辑层实例 - l := logic.NewDeleteLdapOrginationLogic(r.Context(), svcCtx) + l := logic.NewUpdateLdapOrganizationLogic(r.Context(), svcCtx) rl := reflect.ValueOf(l) basic.BeforeLogic(w, r, rl) - resp := l.DeleteLdapOrgination(&req, userinfo) + resp := l.UpdateLdapOrganization(&req, userinfo) if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) diff --git a/server/ldap-admin/internal/logic/addldaporginationmemberlogic.go b/server/ldap-admin/internal/logic/addldaporganizationmemberlogic.go similarity index 56% rename from server/ldap-admin/internal/logic/addldaporginationmemberlogic.go rename to server/ldap-admin/internal/logic/addldaporganizationmemberlogic.go index 72efb73a..887d1217 100644 --- a/server/ldap-admin/internal/logic/addldaporginationmemberlogic.go +++ b/server/ldap-admin/internal/logic/addldaporganizationmemberlogic.go @@ -13,14 +13,14 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) -type AddLdapOrginationMemberLogic struct { +type AddLdapOrganizationMemberLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewAddLdapOrginationMemberLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddLdapOrginationMemberLogic { - return &AddLdapOrginationMemberLogic{ +func NewAddLdapOrganizationMemberLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddLdapOrganizationMemberLogic { + return &AddLdapOrganizationMemberLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, @@ -28,13 +28,13 @@ func NewAddLdapOrginationMemberLogic(ctx context.Context, svcCtx *svc.ServiceCon } // 处理进入前逻辑w,r -// func (l *AddLdapOrginationMemberLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// func (l *AddLdapOrganizationMemberLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } -func (l *AddLdapOrginationMemberLogic) AddLdapOrginationMember(req *types.AddLdapOrginationMemberReq, userinfo *auth.UserInfo) (resp *basic.Response) { - req.OrginationDN = strings.Trim(req.OrginationDN, " ") +func (l *AddLdapOrganizationMemberLogic) AddLdapOrganizationMember(req *types.AddLdapOrganizationMemberReq, userinfo *auth.UserInfo) (resp *basic.Response) { + req.OrganizationDN = strings.Trim(req.OrganizationDN, " ") req.UserDN = strings.Trim(req.UserDN, " ") - if len(req.OrginationDN) <= 3 || req.OrginationDN[:3] != "ou=" { + if len(req.OrganizationDN) <= 3 || req.OrganizationDN[:3] != "ou=" { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "无效的目标组织DN") } if len(req.UserDN) <= 3 || req.UserDN[:3] != "cn=" { @@ -45,6 +45,6 @@ func (l *AddLdapOrginationMemberLogic) AddLdapOrginationMember(req *types.AddLda } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *AddLdapOrginationMemberLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// func (l *AddLdapOrganizationMemberLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // // httpx.OkJsonCtx(r.Context(), w, resp) // } diff --git a/server/ldap-admin/internal/logic/createldaporginationlogic.go b/server/ldap-admin/internal/logic/createldaporganizationlogic.go similarity index 64% rename from server/ldap-admin/internal/logic/createldaporginationlogic.go rename to server/ldap-admin/internal/logic/createldaporganizationlogic.go index eb38d260..b95da217 100644 --- a/server/ldap-admin/internal/logic/createldaporginationlogic.go +++ b/server/ldap-admin/internal/logic/createldaporganizationlogic.go @@ -14,14 +14,14 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) -type CreateLdapOrginationLogic struct { +type CreateLdapOrganizationLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewCreateLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLdapOrginationLogic { - return &CreateLdapOrginationLogic{ +func NewCreateLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLdapOrganizationLogic { + return &CreateLdapOrganizationLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, @@ -29,32 +29,32 @@ func NewCreateLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContex } // 处理进入前逻辑w,r -// func (l *CreateLdapOrginationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// func (l *CreateLdapOrganizationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } -func (l *CreateLdapOrginationLogic) CreateLdapOrgination(req *types.CreateLdapOrginationReq, userinfo *auth.UserInfo) (resp *basic.Response) { - req.OrginationOu = strings.Trim(req.OrginationOu, " ") - req.ParentOrginationDN = strings.Trim(req.ParentOrginationDN, " ") +func (l *CreateLdapOrganizationLogic) CreateLdapOrganization(req *types.CreateLdapOrganizationReq, userinfo *auth.UserInfo) (resp *basic.Response) { + req.OrganizationOu = strings.Trim(req.OrganizationOu, " ") + req.ParentOrganizationDN = strings.Trim(req.ParentOrganizationDN, " ") req.BusinessCategory = strings.Trim(req.BusinessCategory, " ") - if req.OrginationOu == "" { + if req.OrganizationOu == "" { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,organization_ou不能为空") } - if len(strings.Split(req.OrginationOu, ",")) != 1 { + if len(strings.Split(req.OrganizationOu, ",")) != 1 { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,不合法的organization_ou") } - if req.ParentOrginationDN == "" { + if req.ParentOrganizationDN == "" { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,parentOrganization_dn不能为空") } if req.BusinessCategory == "" { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,business_category不能为空") } //组装organization dn - organizationDN := "ou=" + req.OrginationOu + "," + req.ParentOrginationDN + organizationDN := "ou=" + req.OrganizationOu + "," + req.ParentOrganizationDN ldapServer := ldap_lib.NewLdap(l.svcCtx.Ldap, l.svcCtx.Config.Ldap.BaseDN, l.svcCtx.Config.Ldap.RootDN) err := ldapServer.Create(organizationDN, map[string][]string{ "objectClass": {"top", "groupOfUniqueNames"}, "cn": {req.BusinessCategory}, - "ou": {req.OrginationOu}, + "ou": {req.OrganizationOu}, "businessCategory": {req.BusinessCategory}, "uniqueMember": {l.svcCtx.Config.Ldap.RootDN}, //创建groupOfUniqueNames对象类型需要至少一个member,把root加进去 }) @@ -66,6 +66,6 @@ func (l *CreateLdapOrginationLogic) CreateLdapOrgination(req *types.CreateLdapOr } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *CreateLdapOrginationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// func (l *CreateLdapOrganizationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // // httpx.OkJsonCtx(r.Context(), w, resp) // } diff --git a/server/ldap-admin/internal/logic/deleteldaporginationlogic.go b/server/ldap-admin/internal/logic/deleteldaporganizationlogic.go similarity index 52% rename from server/ldap-admin/internal/logic/deleteldaporginationlogic.go rename to server/ldap-admin/internal/logic/deleteldaporganizationlogic.go index e91fd559..c3956d2a 100644 --- a/server/ldap-admin/internal/logic/deleteldaporginationlogic.go +++ b/server/ldap-admin/internal/logic/deleteldaporganizationlogic.go @@ -14,14 +14,14 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) -type DeleteLdapOrginationLogic struct { +type DeleteLdapOrganizationLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewDeleteLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLdapOrginationLogic { - return &DeleteLdapOrginationLogic{ +func NewDeleteLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLdapOrganizationLogic { + return &DeleteLdapOrganizationLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, @@ -29,19 +29,16 @@ func NewDeleteLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContex } // 处理进入前逻辑w,r -// func (l *DeleteLdapOrginationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// func (l *DeleteLdapOrganizationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } -func (l *DeleteLdapOrginationLogic) DeleteLdapOrgination(req *types.DeleteLdapOrginationReq, userinfo *auth.UserInfo) (resp *basic.Response) { - req.OrginationDN = strings.Trim(req.OrginationDN, " ") - if req.OrginationDN == "" { - return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "组织DN不能为空") - } - if len(req.OrginationDN) <= 3 || req.OrginationDN[:3] != "ou=" { +func (l *DeleteLdapOrganizationLogic) DeleteLdapOrganization(req *types.DeleteLdapOrganizationReq, userinfo *auth.UserInfo) (resp *basic.Response) { + req.OrganizationDN = strings.Trim(req.OrganizationDN, " ") + if len(req.OrganizationDN) <= 3 || req.OrganizationDN[:3] != "ou=" { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "无效的组织DN") } ldapServer := ldap_lib.NewLdap(l.svcCtx.Ldap, l.svcCtx.Config.Ldap.BaseDN, l.svcCtx.Config.Ldap.RootDN) - if err := ldapServer.Delete(req.OrginationDN); err != nil { + if err := ldapServer.Delete(req.OrganizationDN); err != nil { logx.Error(err) return resp.SetStatusWithMessage(basic.CodeServiceErr, "删除ldap组织失败,", err.Error()) } @@ -49,6 +46,6 @@ func (l *DeleteLdapOrginationLogic) DeleteLdapOrgination(req *types.DeleteLdapOr } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *DeleteLdapOrginationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// func (l *DeleteLdapOrganizationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // // httpx.OkJsonCtx(r.Context(), w, resp) // } diff --git a/server/ldap-admin/internal/logic/getldaporginationslogic.go b/server/ldap-admin/internal/logic/getldaporganizationslogic.go similarity index 86% rename from server/ldap-admin/internal/logic/getldaporginationslogic.go rename to server/ldap-admin/internal/logic/getldaporganizationslogic.go index 38cf3349..6162499a 100644 --- a/server/ldap-admin/internal/logic/getldaporginationslogic.go +++ b/server/ldap-admin/internal/logic/getldaporganizationslogic.go @@ -16,14 +16,14 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) -type GetLdapOrginationsLogic struct { +type GetLdapOrganizationsLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewGetLdapOrginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLdapOrginationsLogic { - return &GetLdapOrginationsLogic{ +func NewGetLdapOrganizationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLdapOrganizationsLogic { + return &GetLdapOrganizationsLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, @@ -31,7 +31,7 @@ func NewGetLdapOrginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) } // 处理进入前逻辑w,r -// func (l *GetLdapOrginationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// func (l *GetLdapOrganizationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } type DNItem struct { Attribute map[string]interface{} `json:"attribute"` @@ -41,7 +41,7 @@ type DNItem struct { Child []*DNItem `json:"child"` } -func (l *GetLdapOrginationsLogic) GetLdapOrginations(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) { +func (l *GetLdapOrganizationsLogic) GetLdapOrganizations(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) { //从ldap获取组织架构数据 rootCn := strings.Split(l.svcCtx.Config.Ldap.RootDN, ",") if len(rootCn) == 0 { @@ -120,6 +120,6 @@ func (l *GetLdapOrginationsLogic) GetLdapOrginations(req *types.Request, userinf } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *GetLdapOrginationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// func (l *GetLdapOrganizationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // // httpx.OkJsonCtx(r.Context(), w, resp) // } diff --git a/server/ldap-admin/internal/logic/removeldaporginationmemberlogic.go b/server/ldap-admin/internal/logic/removeldaporganizationmemberlogic.go similarity index 53% rename from server/ldap-admin/internal/logic/removeldaporginationmemberlogic.go rename to server/ldap-admin/internal/logic/removeldaporganizationmemberlogic.go index 7d6e0f5e..443a3457 100644 --- a/server/ldap-admin/internal/logic/removeldaporginationmemberlogic.go +++ b/server/ldap-admin/internal/logic/removeldaporganizationmemberlogic.go @@ -12,14 +12,14 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) -type RemoveLdapOrginationMemberLogic struct { +type RemoveLdapOrganizationMemberLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewRemoveLdapOrginationMemberLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RemoveLdapOrginationMemberLogic { - return &RemoveLdapOrginationMemberLogic{ +func NewRemoveLdapOrganizationMemberLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RemoveLdapOrganizationMemberLogic { + return &RemoveLdapOrganizationMemberLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, @@ -27,10 +27,10 @@ func NewRemoveLdapOrginationMemberLogic(ctx context.Context, svcCtx *svc.Service } // 处理进入前逻辑w,r -// func (l *RemoveLdapOrginationMemberLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// func (l *RemoveLdapOrganizationMemberLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } -func (l *RemoveLdapOrginationMemberLogic) RemoveLdapOrginationMember(req *types.RemoveLdapOrginationMemberReq, userinfo *auth.UserInfo) (resp *basic.Response) { +func (l *RemoveLdapOrganizationMemberLogic) RemoveLdapOrganizationMember(req *types.RemoveLdapOrganizationMemberReq, userinfo *auth.UserInfo) (resp *basic.Response) { // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) // userinfo 传入值时, 一定不为null @@ -38,6 +38,6 @@ func (l *RemoveLdapOrginationMemberLogic) RemoveLdapOrginationMember(req *types. } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *RemoveLdapOrginationMemberLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// func (l *RemoveLdapOrganizationMemberLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // // httpx.OkJsonCtx(r.Context(), w, resp) // } diff --git a/server/ldap-admin/internal/logic/updateldaporginationlogic.go b/server/ldap-admin/internal/logic/updateldaporganizationlogic.go similarity index 58% rename from server/ldap-admin/internal/logic/updateldaporginationlogic.go rename to server/ldap-admin/internal/logic/updateldaporganizationlogic.go index 00978ddd..6efc5ba3 100644 --- a/server/ldap-admin/internal/logic/updateldaporginationlogic.go +++ b/server/ldap-admin/internal/logic/updateldaporganizationlogic.go @@ -14,14 +14,14 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) -type UpdateLdapOrginationLogic struct { +type UpdateLdapOrganizationLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewUpdateLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateLdapOrginationLogic { - return &UpdateLdapOrginationLogic{ +func NewUpdateLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateLdapOrganizationLogic { + return &UpdateLdapOrganizationLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, @@ -29,19 +29,19 @@ func NewUpdateLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContex } // 处理进入前逻辑w,r -// func (l *UpdateLdapOrginationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// func (l *UpdateLdapOrganizationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } -func (l *UpdateLdapOrginationLogic) UpdateLdapOrgination(req *types.UpdateLdapOrginationReq, userinfo *auth.UserInfo) (resp *basic.Response) { - req.OrginationDN = strings.Trim(req.OrginationDN, " ") - if req.OrginationDN == "" { +func (l *UpdateLdapOrganizationLogic) UpdateLdapOrganization(req *types.UpdateLdapOrganizationReq, userinfo *auth.UserInfo) (resp *basic.Response) { + req.OrganizationDN = strings.Trim(req.OrganizationDN, " ") + if req.OrganizationDN == "" { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "组织DN不能为空") } - if len(req.OrginationDN) <= 3 || req.OrginationDN[:3] != "ou=" { + if len(req.OrganizationDN) <= 3 || req.OrganizationDN[:3] != "ou=" { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "无效的组织DN") } ldapServer := ldap_lib.NewLdap(l.svcCtx.Ldap, l.svcCtx.Config.Ldap.BaseDN, l.svcCtx.Config.Ldap.RootDN) - if err := ldapServer.Update(req.OrginationDN, map[string][]string{ + if err := ldapServer.Update(req.OrganizationDN, map[string][]string{ "cn": {req.BusinessCategory}, "businessCategory": {req.BusinessCategory}, }); err != nil { @@ -52,6 +52,6 @@ func (l *UpdateLdapOrginationLogic) UpdateLdapOrgination(req *types.UpdateLdapOr } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *UpdateLdapOrginationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// func (l *UpdateLdapOrganizationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // // httpx.OkJsonCtx(r.Context(), w, resp) // } diff --git a/server/ldap-admin/internal/types/types.go b/server/ldap-admin/internal/types/types.go index 758a9c98..d92e6240 100644 --- a/server/ldap-admin/internal/types/types.go +++ b/server/ldap-admin/internal/types/types.go @@ -73,18 +73,18 @@ type MenuItem struct { Status int64 `json:"status"` } -type CreateLdapOrginationReq struct { - OrginationOu string `json:"orgination_ou"` //组织ou - BusinessCategory string `json:"business_category"` //组织分类名称 - ParentOrginationDN string `json:"parent_orgination_dn"` //父级dn +type CreateLdapOrganizationReq struct { + OrganizationOu string `json:"organization_ou"` //组织ou + BusinessCategory string `json:"business_category"` //组织分类名称 + ParentOrganizationDN string `json:"parent_organization_dn"` //父级dn } -type DeleteLdapOrginationReq struct { - OrginationDN string `json:"orgination_dn"` //组织dn +type DeleteLdapOrganizationReq struct { + OrganizationDN string `json:"organization_dn"` //组织dn } -type UpdateLdapOrginationReq struct { - OrginationDN string `json:"orgination_dn"` //组织dn +type UpdateLdapOrganizationReq struct { + OrganizationDN string `json:"organization_dn"` //组织dn BusinessCategory string `json:"business_category"` //组织分类名称 } @@ -124,14 +124,14 @@ type GetLdapUserInfoRsp struct { Status int64 `json:"status,options=0|1"` //状态 1正常0离职 } -type AddLdapOrginationMemberReq struct { - OrginationDN string `json:"orgination_dn"` //目标组织DN - UserDN string `json:"user_dn"` //用户DN +type AddLdapOrganizationMemberReq struct { + OrganizationDN string `json:"organization_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN } -type RemoveLdapOrginationMemberReq struct { - OrginationDN string `json:"orgination_dn"` //目标组织DN - UserDN string `json:"user_dn"` //用户DN +type RemoveLdapOrganizationMemberReq struct { + OrganizationDN string `json:"organization_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN } type Request struct { diff --git a/server_api/ldap-admin.api b/server_api/ldap-admin.api index e1842022..d05e3a2c 100644 --- a/server_api/ldap-admin.api +++ b/server_api/ldap-admin.api @@ -31,17 +31,17 @@ service ldap-admin { @handler GetMenusHandler get /api/ldap-admin/get_menus(GetMenusReq) returns (response); //获取ldap组织列表 - @handler GetLdapOrginationsHandler - get /api/ldap-admin/get_ldap_orginations(request) returns (response); + @handler GetLdapOrganizationsHandler + get /api/ldap-admin/get_ldap_organizations(request) returns (response); //增加ldap组织 - @handler CreateLdapOrginationHandler - post /api/ldap-admin/create_ldap_orgination(CreateLdapOrginationReq) returns (response); + @handler CreateLdapOrganizationHandler + post /api/ldap-admin/create_ldap_organization(CreateLdapOrganizationReq) returns (response); //删除ldap组织 - @handler DeleteLdapOrginationHandler - post /api/ldap-admin/delete_ldap_orgination(DeleteLdapOrginationReq) returns (response); + @handler DeleteLdapOrganizationHandler + post /api/ldap-admin/delete_ldap_organization(DeleteLdapOrganizationReq) returns (response); //修改ldap组织 - @handler UpdateLdapOrginationHandler - post /api/ldap-admin/update_ldap_orgination(UpdateLdapOrginationReq) returns (response); + @handler UpdateLdapOrganizationHandler + post /api/ldap-admin/update_ldap_organization(UpdateLdapOrganizationReq) returns (response); //添加ldap用户到员工基本组中 @handler CreateLdapUserHandler post /api/ldap-admin/create_ldap_user(CreateLdapUserReq) returns (response); @@ -55,11 +55,11 @@ service ldap-admin { @handler GetLdapUserInfoHandler get /api/ldap-admin/get_ldap_user_info(GetLdapUserInfoReq) returns (response); //ldap组织添加成员 - @handler AddLdapOrginationMemberHandler - post /api/ldap-admin/add_ldap_orgination_member(AddLdapOrginationMemberReq) returns (response); + @handler AddLdapOrganizationMemberHandler + post /api/ldap-admin/add_ldap_organization_member(AddLdapOrganizationMemberReq) returns (response); //ldap组织移除成员 - @handler RemoveLdapOrginationMemberHandler - post /api/ldap-admin/remove_ldap_orgination_member(RemoveLdapOrginationMemberReq) returns (response); + @handler RemoveLdapOrganizationMemberHandler + post /api/ldap-admin/remove_ldap_organization_member(RemoveLdapOrganizationMemberReq) returns (response); } type GetApisReq { @@ -128,18 +128,18 @@ type MenuItem { Status int64 `json:"status"` } //增加ldap组织 -type CreateLdapOrginationReq { - OrginationOu string `json:"orgination_ou"` //组织ou - BusinessCategory string `json:"business_category"` //组织分类名称 - ParentOrginationDN string `json:"parent_orgination_dn"` //父级dn +type CreateLdapOrganizationReq { + OrganizationOu string `json:"organization_ou"` //组织ou + BusinessCategory string `json:"business_category"` //组织分类名称 + ParentOrganizationDN string `json:"parent_organization_dn"` //父级dn } //删除ldap组织 -type DeleteLdapOrginationReq { - OrginationDN string `json:"orgination_dn"` //组织dn +type DeleteLdapOrganizationReq { + OrganizationDN string `json:"organization_dn"` //组织dn } //修改ldap组织 -type UpdateLdapOrginationReq { - OrginationDN string `json:"orgination_dn"` //组织dn +type UpdateLdapOrganizationReq { + OrganizationDN string `json:"organization_dn"` //组织dn BusinessCategory string `json:"business_category"` //组织分类名称 } //添加ldap用户到员工基本组中 @@ -178,12 +178,12 @@ type GetLdapUserInfoRsp { Status int64 `json:"status,options=0|1"` //状态 1正常0离职 } //ldap组织添加成员 -type AddLdapOrginationMemberReq { - OrginationDN string `json:"orgination_dn"` //目标组织DN - UserDN string `json:"user_dn"` //用户DN +type AddLdapOrganizationMemberReq { + OrganizationDN string `json:"organization_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN } //ldap组织移除成员 -type RemoveLdapOrginationMemberReq { - OrginationDN string `json:"orgination_dn"` //目标组织DN - UserDN string `json:"user_dn"` //用户DN +type RemoveLdapOrganizationMemberReq { + OrganizationDN string `json:"organization_dn"` //目标组织DN + UserDN string `json:"user_dn"` //用户DN } \ No newline at end of file