新增:权限分组模块

This commit is contained in:
momo 2023-11-17 15:36:44 +08:00
commit 3a51cc35ca
3 changed files with 25 additions and 19 deletions

View File

@ -40,6 +40,9 @@ func (l *UpdateLdapUserLogic) UpdateLdapUser(req *types.UpdateLdapUserReq, useri
req.Password = strings.Trim(req.Password, " ") req.Password = strings.Trim(req.Password, " ")
req.Avatar = strings.Trim(req.Avatar, " ") req.Avatar = strings.Trim(req.Avatar, " ")
req.UserName = strings.Trim(req.UserName, " ") req.UserName = strings.Trim(req.UserName, " ")
if req.AuthGroupId < 0 {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误无效的用户权限组id")
}
if req.Password != "" { if req.Password != "" {
//todo 验证下是不是本人 //todo 验证下是不是本人
} }
@ -51,6 +54,7 @@ func (l *UpdateLdapUserLogic) UpdateLdapUser(req *types.UpdateLdapUserReq, useri
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.Update(req.UserDN, map[string][]string{ err := ldapServer.Update(req.UserDN, map[string][]string{
"homeDirectory": {"/home/users/" + userNamePinyin}, "homeDirectory": {"/home/users/" + userNamePinyin},
"departmentNumber": {fmt.Sprintf("%d", req.AuthGroupId)},
"sn": {req.UserName}, "sn": {req.UserName},
"uid": {userNamePinyin}, "uid": {userNamePinyin},
"mobile": {req.Mobile}, "mobile": {req.Mobile},

View File

@ -146,6 +146,7 @@ type UpdateLdapUserReq struct {
Mobile string `json:"mobile,optional"` //手机号 Mobile string `json:"mobile,optional"` //手机号
Avatar string `json:"avatar,optional"` //头像地址 Avatar string `json:"avatar,optional"` //头像地址
Status int64 `json:"status,options=0|1"` //状态 1正常0离职 Status int64 `json:"status,options=0|1"` //状态 1正常0离职
AuthGroupId int64 `json:"authGroupId"` //权限分组id
} }
type DeleteLdapUserReq struct { type DeleteLdapUserReq struct {

View File

@ -221,6 +221,7 @@ type UpdateLdapUserReq {
Mobile string `json:"mobile,optional"` //手机号 Mobile string `json:"mobile,optional"` //手机号
Avatar string `json:"avatar,optional"` //头像地址 Avatar string `json:"avatar,optional"` //头像地址
Status int64 `json:"status,options=0|1"` //状态 1正常0离职 Status int64 `json:"status,options=0|1"` //状态 1正常0离职
AuthGroupId int64 `json:"authGroupId"` //权限分组id
} }
//删除ldap用户 //删除ldap用户
type DeleteLdapUserReq { type DeleteLdapUserReq {