This commit is contained in:
laodaming 2023-11-21 10:13:12 +08:00
parent f4cbb23aa0
commit f946f2926a
4 changed files with 9 additions and 6 deletions

View File

@ -42,6 +42,9 @@ func (l *CreateLdapUserLogic) CreateLdapUser(req *types.CreateLdapUserReq, useri
req.Mobile = strings.Trim(req.Mobile, " ")
req.Email = strings.Trim(req.Email, " ")
req.Password = strings.Trim(req.Password, " ")
if req.GroupId < 0 {
req.GroupId = 0
}
if req.UserName == "" {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误,用户名不能为空")
}

View File

@ -40,7 +40,7 @@ func (l *UpdateLdapUserLogic) UpdateLdapUser(req *types.UpdateLdapUserReq, useri
req.Mobile = strings.Trim(req.Mobile, " ")
req.Avatar = strings.Trim(req.Avatar, " ")
req.UserName = strings.Trim(req.UserName, " ")
if req.AuthGroupId < 0 {
if req.GroupId < 0 {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "参数错误无效的用户权限组id")
}
if len(req.UserDN) <= 3 || req.UserDN[:3] != "cn=" {
@ -56,7 +56,7 @@ func (l *UpdateLdapUserLogic) UpdateLdapUser(req *types.UpdateLdapUserReq, useri
//更新的属性
attr := map[string][]string{
"homeDirectory": {"/home/users/" + userNamePinyin},
"departmentNumber": {fmt.Sprintf("%d", req.AuthGroupId)},
"departmentNumber": {fmt.Sprintf("%d", req.GroupId)},
"sn": {req.UserName},
"uid": {userNamePinyin},
"mobile": {req.Mobile},

View File

@ -137,7 +137,7 @@ type CreateLdapUserReq struct {
Mobile string `json:"mobile"` //手机号
Avatar string `json:"avatar"` //头像地址
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
GroupId int64 `json:"group_id"` //分组id
GroupId int64 `json:"group_id,optional"` //分组id
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
}
@ -148,7 +148,7 @@ type UpdateLdapUserReq struct {
Avatar string `json:"avatar,optional"` //头像地址
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
AuthGroupId int64 `json:"auth_group_id,optional"` //权限分组id
GroupId int64 `json:"group_id,optional"` //权限分组id
}
type UpdateLdapUserPwdReq struct {

View File

@ -221,7 +221,7 @@ type CreateLdapUserReq {
Mobile string `json:"mobile"` //手机号
Avatar string `json:"avatar"` //头像地址
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
GroupId int64 `json:"group_id"` //分组id
GroupId int64 `json:"group_id,optional"` //分组id
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
}
//修改ldap用户信息
@ -232,7 +232,7 @@ type UpdateLdapUserReq {
Avatar string `json:"avatar,optional"` //头像地址
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
AuthGroupId int64 `json:"auth_group_id,optional"` //权限分组id
GroupId int64 `json:"group_id,optional"` //权限分组id
}
//修改用户密码
type UpdateLdapUserPwdReq {