增加添加部门接口
This commit is contained in:
parent
6fb16aa12c
commit
c7ca444fe7
@ -11,22 +11,22 @@ import (
|
|||||||
"fusenapi/server/ldap-admin/internal/types"
|
"fusenapi/server/ldap-admin/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func CreateLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
var req types.CreateLdapOrganizationReq
|
var req types.CreateLdapOrginationReq
|
||||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个业务逻辑层实例
|
// 创建一个业务逻辑层实例
|
||||||
l := logic.NewCreateLdapOrganizationLogic(r.Context(), svcCtx)
|
l := logic.NewCreateLdapOrginationLogic(r.Context(), svcCtx)
|
||||||
|
|
||||||
rl := reflect.ValueOf(l)
|
rl := reflect.ValueOf(l)
|
||||||
basic.BeforeLogic(w, r, rl)
|
basic.BeforeLogic(w, r, rl)
|
||||||
|
|
||||||
resp := l.CreateLdapOrganization(&req, userinfo)
|
resp := l.CreateLdapOrgination(&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)
|
@ -11,22 +11,22 @@ import (
|
|||||||
"fusenapi/server/ldap-admin/internal/types"
|
"fusenapi/server/ldap-admin/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func DeleteLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
var req types.DeleteLdapOrganizationReq
|
var req types.DeleteLdapOrginationReq
|
||||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个业务逻辑层实例
|
// 创建一个业务逻辑层实例
|
||||||
l := logic.NewDeleteLdapOrganizationLogic(r.Context(), svcCtx)
|
l := logic.NewDeleteLdapOrginationLogic(r.Context(), svcCtx)
|
||||||
|
|
||||||
rl := reflect.ValueOf(l)
|
rl := reflect.ValueOf(l)
|
||||||
basic.BeforeLogic(w, r, rl)
|
basic.BeforeLogic(w, r, rl)
|
||||||
|
|
||||||
resp := l.DeleteLdapOrganization(&req, userinfo)
|
resp := l.DeleteLdapOrgination(&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)
|
@ -11,7 +11,7 @@ import (
|
|||||||
"fusenapi/server/ldap-admin/internal/types"
|
"fusenapi/server/ldap-admin/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetOrganizationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetorginationsHandler(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 GetOrganizationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个业务逻辑层实例
|
// 创建一个业务逻辑层实例
|
||||||
l := logic.NewGetOrganizationsLogic(r.Context(), svcCtx)
|
l := logic.NewGetorginationsLogic(r.Context(), svcCtx)
|
||||||
|
|
||||||
rl := reflect.ValueOf(l)
|
rl := reflect.ValueOf(l)
|
||||||
basic.BeforeLogic(w, r, rl)
|
basic.BeforeLogic(w, r, rl)
|
||||||
|
|
||||||
resp := l.GetOrganizations(&req, userinfo)
|
resp := l.Getorginations(&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)
|
@ -44,23 +44,23 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodGet,
|
Method: http.MethodGet,
|
||||||
Path: "/api/ldap-admin/get_organizations",
|
Path: "/api/ldap-admin/get_ldap_orginations",
|
||||||
Handler: GetOrganizationsHandler(serverCtx),
|
Handler: GetorginationsHandler(serverCtx),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/api/ldap-admin/create_ldap_orgination",
|
Path: "/api/ldap-admin/create_ldap_orgination",
|
||||||
Handler: CreateLdapOrganizationHandler(serverCtx),
|
Handler: CreateLdapOrginationHandler(serverCtx),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/api/ldap-admin/delete_ldap_orgination",
|
Path: "/api/ldap-admin/delete_ldap_orgination",
|
||||||
Handler: DeleteLdapOrganizationHandler(serverCtx),
|
Handler: DeleteLdapOrginationHandler(serverCtx),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/api/ldap-admin/update_ldap_orgination",
|
Path: "/api/ldap-admin/update_ldap_orgination",
|
||||||
Handler: UpdateLdapOrganizationHandler(serverCtx),
|
Handler: UpdateLdapOrginationHandler(serverCtx),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -11,22 +11,22 @@ import (
|
|||||||
"fusenapi/server/ldap-admin/internal/types"
|
"fusenapi/server/ldap-admin/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func UpdateLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
var req types.UpdateLdapOrganizationReq
|
var req types.UpdateLdapOrginationReq
|
||||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个业务逻辑层实例
|
// 创建一个业务逻辑层实例
|
||||||
l := logic.NewUpdateLdapOrganizationLogic(r.Context(), svcCtx)
|
l := logic.NewUpdateLdapOrginationLogic(r.Context(), svcCtx)
|
||||||
|
|
||||||
rl := reflect.ValueOf(l)
|
rl := reflect.ValueOf(l)
|
||||||
basic.BeforeLogic(w, r, rl)
|
basic.BeforeLogic(w, r, rl)
|
||||||
|
|
||||||
resp := l.UpdateLdapOrganization(&req, userinfo)
|
resp := l.UpdateLdapOrgination(&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)
|
@ -14,14 +14,14 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateLdapOrganizationLogic struct {
|
type CreateLdapOrginationLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCreateLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLdapOrganizationLogic {
|
func NewCreateLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLdapOrginationLogic {
|
||||||
return &CreateLdapOrganizationLogic{
|
return &CreateLdapOrginationLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
svcCtx: svcCtx,
|
||||||
@ -29,31 +29,31 @@ func NewCreateLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理进入前逻辑w,r
|
// 处理进入前逻辑w,r
|
||||||
// func (l *CreateLdapOrganizationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
// func (l *CreateLdapOrginationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (l *CreateLdapOrganizationLogic) CreateLdapOrganization(req *types.CreateLdapOrganizationReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *CreateLdapOrginationLogic) CreateLdapOrgination(req *types.CreateLdapOrginationReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
req.OrganizationOu = strings.Trim(req.OrganizationOu, " ")
|
req.OrginationOu = strings.Trim(req.OrginationOu, " ")
|
||||||
req.ParentOrganizationDN = strings.Trim(req.ParentOrganizationDN, " ")
|
req.ParentOrginationDN = strings.Trim(req.ParentOrginationDN, " ")
|
||||||
req.BusinessCategory = strings.Trim(req.BusinessCategory, " ")
|
req.BusinessCategory = strings.Trim(req.BusinessCategory, " ")
|
||||||
if req.OrganizationOu == "" {
|
if req.OrginationOu == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,organization_ou不能为空")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,organization_ou不能为空")
|
||||||
}
|
}
|
||||||
if len(strings.Split(req.OrganizationOu, ",")) != 1 {
|
if len(strings.Split(req.OrginationOu, ",")) != 1 {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,不合法的organization_ou")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,不合法的organization_ou")
|
||||||
}
|
}
|
||||||
if req.ParentOrganizationDN == "" {
|
if req.ParentOrginationDN == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,parentOrganization_dn不能为空")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,parentOrganization_dn不能为空")
|
||||||
}
|
}
|
||||||
if req.BusinessCategory == "" {
|
if req.BusinessCategory == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,business_category不能为空")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,business_category不能为空")
|
||||||
}
|
}
|
||||||
//组装organization dn
|
//组装organization dn
|
||||||
organizationDN := "ou=" + req.OrganizationOu + "," + req.ParentOrganizationDN
|
organizationDN := "ou=" + req.OrginationOu + "," + req.ParentOrginationDN
|
||||||
ldapServer := ldap_lib.NewLdap(l.svcCtx.Ldap, l.svcCtx.Config.Ldap.BaseDN, l.svcCtx.Config.Ldap.RootDN)
|
ldapServer := ldap_lib.NewLdap(l.svcCtx.Ldap, l.svcCtx.Config.Ldap.BaseDN, l.svcCtx.Config.Ldap.RootDN)
|
||||||
err := ldapServer.Create(organizationDN, map[string][]string{
|
err := ldapServer.Create(organizationDN, map[string][]string{
|
||||||
"objectClass": {"top", "organizationalUnit"},
|
"objectClass": {"top", "organizationalUnit"},
|
||||||
"ou": {req.OrganizationOu},
|
"ou": {req.OrginationOu},
|
||||||
"businessCategory": {req.BusinessCategory},
|
"businessCategory": {req.BusinessCategory},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -64,6 +64,6 @@ func (l *CreateLdapOrganizationLogic) CreateLdapOrganization(req *types.CreateLd
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||||
// func (l *CreateLdapOrganizationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
// func (l *CreateLdapOrginationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
// }
|
// }
|
@ -12,14 +12,14 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateLdapOrganizationLogic struct {
|
type DeleteLdapOrginationLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUpdateLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateLdapOrganizationLogic {
|
func NewDeleteLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLdapOrginationLogic {
|
||||||
return &UpdateLdapOrganizationLogic{
|
return &DeleteLdapOrginationLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
svcCtx: svcCtx,
|
||||||
@ -27,10 +27,10 @@ func NewUpdateLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理进入前逻辑w,r
|
// 处理进入前逻辑w,r
|
||||||
// func (l *UpdateLdapOrganizationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
// func (l *DeleteLdapOrginationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (l *UpdateLdapOrganizationLogic) UpdateLdapOrganization(req *types.UpdateLdapOrganizationReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *DeleteLdapOrginationLogic) DeleteLdapOrgination(req *types.DeleteLdapOrginationReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||||
// userinfo 传入值时, 一定不为null
|
// userinfo 传入值时, 一定不为null
|
||||||
|
|
||||||
@ -38,6 +38,6 @@ func (l *UpdateLdapOrganizationLogic) UpdateLdapOrganization(req *types.UpdateLd
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||||
// func (l *UpdateLdapOrganizationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
// func (l *DeleteLdapOrginationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
// }
|
// }
|
@ -15,14 +15,14 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetOrganizationsLogic struct {
|
type GetorginationsLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGetOrganizationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetOrganizationsLogic {
|
func NewGetorginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetorginationsLogic {
|
||||||
return &GetOrganizationsLogic{
|
return &GetorginationsLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
svcCtx: svcCtx,
|
||||||
@ -30,7 +30,7 @@ func NewGetOrganizationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理进入前逻辑w,r
|
// 处理进入前逻辑w,r
|
||||||
// func (l *GetOrganizationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
// func (l *GetorginationsLogic) 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 *GetOrganizationsLogic) GetOrganizations(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetorginationsLogic) Getorginations(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 {
|
||||||
@ -115,6 +115,6 @@ func (l *GetOrganizationsLogic) GetOrganizations(req *types.Request, userinfo *a
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||||
// func (l *GetOrganizationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
// func (l *GetorginationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
// }
|
// }
|
@ -12,14 +12,14 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeleteLdapOrganizationLogic struct {
|
type UpdateLdapOrginationLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDeleteLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLdapOrganizationLogic {
|
func NewUpdateLdapOrginationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateLdapOrginationLogic {
|
||||||
return &DeleteLdapOrganizationLogic{
|
return &UpdateLdapOrginationLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
svcCtx: svcCtx,
|
||||||
@ -27,10 +27,10 @@ func NewDeleteLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理进入前逻辑w,r
|
// 处理进入前逻辑w,r
|
||||||
// func (l *DeleteLdapOrganizationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
// func (l *UpdateLdapOrginationLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (l *DeleteLdapOrganizationLogic) DeleteLdapOrganization(req *types.DeleteLdapOrganizationReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *UpdateLdapOrginationLogic) UpdateLdapOrgination(req *types.UpdateLdapOrginationReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||||
// userinfo 传入值时, 一定不为null
|
// userinfo 传入值时, 一定不为null
|
||||||
|
|
||||||
@ -38,6 +38,6 @@ func (l *DeleteLdapOrganizationLogic) DeleteLdapOrganization(req *types.DeleteLd
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||||
// func (l *DeleteLdapOrganizationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
// func (l *UpdateLdapOrginationLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
// }
|
// }
|
@ -73,18 +73,18 @@ type MenuItem struct {
|
|||||||
Status int64 `json:"status"`
|
Status int64 `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateLdapOrganizationReq struct {
|
type CreateLdapOrginationReq struct {
|
||||||
OrganizationOu string `json:"organization_ou"` //组织ou
|
OrginationOu string `json:"orgination_ou"` //组织ou
|
||||||
BusinessCategory string `json:"business_category"` //组织分类名称
|
BusinessCategory string `json:"business_category"` //组织分类名称
|
||||||
ParentOrganizationDN string `json:"parent_organization_dn"` //父级dn
|
ParentOrginationDN string `json:"parent_orgination_dn"` //父级dn
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteLdapOrganizationReq struct {
|
type DeleteLdapOrginationReq struct {
|
||||||
OrganizationDN string `json:"organization_dn"` //组织dn
|
OrginationDN string `json:"orgination_dn"` //组织dn
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateLdapOrganizationReq struct {
|
type UpdateLdapOrginationReq struct {
|
||||||
OrganizationDN string `json:"organization_dn"` //组织dn
|
OrginationDN string `json:"orgination_dn"` //组织dn
|
||||||
BusinessCategory string `json:"business_category"` //组织分类名称
|
BusinessCategory string `json:"business_category"` //组织分类名称
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,17 +31,17 @@ 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 GetOrganizationsHandler
|
@handler GetorginationsHandler
|
||||||
get /api/ldap-admin/get_organizations(request) returns (response);
|
get /api/ldap-admin/get_ldap_orginations(request) returns (response);
|
||||||
//增加ldap组织
|
//增加ldap组织
|
||||||
@handler CreateLdapOrganizationHandler
|
@handler CreateLdapOrginationHandler
|
||||||
post /api/ldap-admin/create_ldap_orgination(CreateLdapOrganizationReq) returns (response);
|
post /api/ldap-admin/create_ldap_orgination(CreateLdapOrginationReq) returns (response);
|
||||||
//删除ldap组织
|
//删除ldap组织
|
||||||
@handler DeleteLdapOrganizationHandler
|
@handler DeleteLdapOrginationHandler
|
||||||
post /api/ldap-admin/delete_ldap_orgination(DeleteLdapOrganizationReq) returns (response);
|
post /api/ldap-admin/delete_ldap_orgination(DeleteLdapOrginationReq) returns (response);
|
||||||
//修改组织
|
//修改组织
|
||||||
@handler UpdateLdapOrganizationHandler
|
@handler UpdateLdapOrginationHandler
|
||||||
post /api/ldap-admin/update_ldap_orgination(UpdateLdapOrganizationReq) returns (response);
|
post /api/ldap-admin/update_ldap_orgination(UpdateLdapOrginationReq) returns (response);
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetApisReq {
|
type GetApisReq {
|
||||||
@ -110,17 +110,17 @@ type MenuItem {
|
|||||||
Status int64 `json:"status"`
|
Status int64 `json:"status"`
|
||||||
}
|
}
|
||||||
//增加ldap组织
|
//增加ldap组织
|
||||||
type CreateLdapOrganizationReq {
|
type CreateLdapOrginationReq {
|
||||||
OrganizationOu string `json:"organization_ou"` //组织ou
|
OrginationOu string `json:"orgination_ou"` //组织ou
|
||||||
BusinessCategory string `json:"business_category"` //组织分类名称
|
BusinessCategory string `json:"business_category"` //组织分类名称
|
||||||
ParentOrganizationDN string `json:"parent_organization_dn"` //父级dn
|
ParentOrginationDN string `json:"parent_orgination_dn"` //父级dn
|
||||||
}
|
}
|
||||||
//删除ldap组织
|
//删除ldap组织
|
||||||
type DeleteLdapOrganizationReq {
|
type DeleteLdapOrginationReq {
|
||||||
OrganizationDN string `json:"organization_dn"` //组织dn
|
OrginationDN string `json:"orgination_dn"` //组织dn
|
||||||
}
|
}
|
||||||
//修改ldap组织
|
//修改ldap组织
|
||||||
type UpdateLdapOrganizationReq {
|
type UpdateLdapOrginationReq {
|
||||||
OrganizationDN string `json:"organization_dn"` //组织dn
|
OrginationDN string `json:"orgination_dn"` //组织dn
|
||||||
BusinessCategory string `json:"business_category"` //组织分类名称
|
BusinessCategory string `json:"business_category"` //组织分类名称
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user