增加删除部门接口
This commit is contained in:
parent
67ef0ae547
commit
aec7ea5c08
|
@ -37,12 +37,18 @@ func (l *UpdateLdapOrginationLogic) UpdateLdapOrgination(req *types.UpdateLdapOr
|
|||
if req.OrginationDN == "" {
|
||||
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 {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "删除ldap组织失败,", err.Error())
|
||||
if len(req.OrginationDN) <= 3 || req.OrginationDN[:3] != "ou=" {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "无效的组织DN")
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "删除成功")
|
||||
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{
|
||||
"orgination_dn": {req.OrginationDN},
|
||||
"business_category": {req.BusinessCategory},
|
||||
}); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "更新ldap组织失败,", err.Error())
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "更新成功")
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user