fix
This commit is contained in:
parent
71850d505e
commit
86216a6456
|
@ -33,10 +33,10 @@ func NewCreateLdapOrganizationLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||
// }
|
||||
|
||||
func (l *CreateLdapOrganizationLogic) CreateLdapOrganization(req *types.CreateLdapOrganizationReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
req.OrganizationOu = strings.Trim(req.OrganizationOu, " ")
|
||||
req.OrganizationEnName = strings.Trim(req.OrganizationEnName, " ")
|
||||
req.ParentOrganizationDN = strings.Trim(req.ParentOrganizationDN, " ")
|
||||
req.BusinessCategory = strings.Trim(req.BusinessCategory, " ")
|
||||
if len(strings.Split(req.OrganizationOu, ",")) != 1 {
|
||||
if len(strings.Split(req.OrganizationEnName, ",")) != 1 {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,不合法的组织ou")
|
||||
}
|
||||
if req.ParentOrganizationDN == "" {
|
||||
|
@ -46,12 +46,12 @@ func (l *CreateLdapOrganizationLogic) CreateLdapOrganization(req *types.CreateLd
|
|||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,分类名不能为空")
|
||||
}
|
||||
//组装organization dn
|
||||
organizationDN := "ou=" + req.OrganizationOu + "," + req.ParentOrganizationDN
|
||||
organizationDN := "ou=" + req.OrganizationEnName + "," + 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.OrganizationOu},
|
||||
"ou": {req.OrganizationEnName},
|
||||
"businessCategory": {req.BusinessCategory},
|
||||
"uniqueMember": {l.svcCtx.Config.Ldap.RootDN}, //创建groupOfUniqueNames对象类型需要至少一个member,把root加进去
|
||||
})
|
||||
|
|
|
@ -107,7 +107,7 @@ type MenuItem struct {
|
|||
}
|
||||
|
||||
type CreateLdapOrganizationReq struct {
|
||||
OrganizationOu string `json:"organization_ou"` //组织ou
|
||||
OrganizationEnName string `json:"organization_en_name"` //组织英文名
|
||||
BusinessCategory string `json:"business_category"` //组织分类名称
|
||||
ParentOrganizationDN string `json:"parent_organization_dn"` //父级dn
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ type MenuItem {
|
|||
}
|
||||
//增加ldap组织
|
||||
type CreateLdapOrganizationReq {
|
||||
OrganizationOu string `json:"organization_ou"` //组织ou
|
||||
OrganizationEnName string `json:"organization_en_name"` //组织英文名
|
||||
BusinessCategory string `json:"business_category"` //组织分类名称
|
||||
ParentOrganizationDN string `json:"parent_organization_dn"` //父级dn
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user