fix: 从ldap同步过来之后groupType字段的问题 (#86)
This commit is contained in:
parent
0c131ede94
commit
0bdefa9484
|
@ -2,6 +2,7 @@ package logic
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/eryajf/go-ldap-admin/model"
|
||||
"github.com/eryajf/go-ldap-admin/public/client/openldap"
|
||||
|
@ -63,7 +64,7 @@ func (d OpenLdapLogic) AddDepts(group *model.Group) error {
|
|||
if !isql.Group.Exist(tools.H{"group_dn": group.GroupDN}) {
|
||||
// 此时的 group 已经附带了Build后动态关联好的字段,接下来将一些确定性的其他字段值添加上,就可以创建这个分组了
|
||||
group.Creator = "system"
|
||||
group.GroupType = "cn"
|
||||
group.GroupType = strings.Split(strings.Split(group.GroupDN, ",")[0], "=")[0]
|
||||
parentid, err := d.getParentGroupID(group)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -705,7 +705,7 @@ func InitData() {
|
|||
GroupName: "root",
|
||||
Remark: "Base",
|
||||
Creator: "system",
|
||||
GroupType: "ou",
|
||||
GroupType: "",
|
||||
ParentId: 0,
|
||||
SourceDeptId: "0",
|
||||
Source: "openldap",
|
||||
|
@ -748,50 +748,6 @@ func InitData() {
|
|||
SourceDeptParentId: fmt.Sprintf("%s_%d", config.Conf.FeiShu.Flag, 0),
|
||||
GroupDN: fmt.Sprintf("ou=%s,%s", config.Conf.FeiShu.Flag+"root", config.Conf.Ldap.BaseDN),
|
||||
},
|
||||
// {
|
||||
// Model: gorm.Model{ID: 2},
|
||||
// GroupName: "jenkins",
|
||||
// Remark: "Jenkins对应权限组管理",
|
||||
// Creator: "系统",
|
||||
// GroupType: "ou",
|
||||
// ParentId: 0,
|
||||
// },
|
||||
// {
|
||||
// Model: gorm.Model{ID: 3},
|
||||
// GroupName: "ceshizu",
|
||||
// Remark: "测试组",
|
||||
// Creator: "系统",
|
||||
// GroupType: "cn",
|
||||
// Users: users[:1],
|
||||
// ParentId: 1,
|
||||
// },
|
||||
// {
|
||||
// Model: gorm.Model{ID: 4},
|
||||
// GroupName: "yunweizu",
|
||||
// Remark: "运维组",
|
||||
// Creator: "系统",
|
||||
// GroupType: "cn",
|
||||
// Users: users[:1],
|
||||
// ParentId: 1,
|
||||
// },
|
||||
// {
|
||||
// Model: gorm.Model{ID: 5},
|
||||
// GroupName: "test-admin",
|
||||
// Remark: "admin测试环境",
|
||||
// Creator: "系统",
|
||||
// GroupType: "cn",
|
||||
// Users: users[:1],
|
||||
// ParentId: 2,
|
||||
// },
|
||||
// {
|
||||
// Model: gorm.Model{ID: 6},
|
||||
// GroupName: "prod-admin",
|
||||
// Remark: "admin正式环境",
|
||||
// Creator: "系统",
|
||||
// GroupType: "cn",
|
||||
// Users: users[:1],
|
||||
// ParentId: 2,
|
||||
// },
|
||||
}
|
||||
|
||||
for _, group := range groups {
|
||||
|
|
Loading…
Reference in New Issue