我想用入口用户和2个用户填充我的示例ldap服务器:uid,sn,cn,employeeType和userPassword,如下所示:
ValidatorValidate()
使用命令dn: dc=example, dc=com
objectclass: organization
objectclass: top
o: example
dn: ou=user, dc=example, dc=com
objectclass: ou
ou: user
dn: uid=john, ou=user, dc=example, dc=com
objectclass: person
uid: john
sn: Doe
cn: John Doe
employeeType: admin
userPassword: 123456
dn: uid=peter, ou=user, dc=example, dc=com
objectclass: person
uid: peter
sn: Doe
cn: Peter Doe
employeeType: employer
userPassword: 654321
我收到错误
ldapadd -x -D 'cn=root,dc=example,dc=com' -W
我认为问题是我的 slapd.conf 文件:
adding new entry "ou=user, dc=example, dc=com objectclass: ou ou: user"
ldap_add: Protocol error (2)
additional info: no attributes provided
我需要在slapd.conf文件中更改哪些内容才能添加我需要的层次结构和条目? 提前谢谢。
答案 0 :(得分:0)
它使用命令var obj = {"categories":[{"title":"category 1","id":"cat1","groups":[{"title":"group 1","id":"grp1","charts":[{"title":"chart 1","id":"chart1","type":"line"}]}]},{"title":"category 2","id":"cat2","charts":[{"title":"chart 2","id":"chart2","type":"line"}]},{"title":"category 3","id":"cat3","charts":[{"title":"chart 3","id":"chart3","type":"line"}]}]}
function findObj(data, id) {
var result = [];
if (Array.isArray(data)) {
data.forEach(function(e) {
result = result.concat(findObj(e, id))
})
} else if (typeof data == 'object' && !Array.isArray(data)) {
var f = null;
Object.keys(data).forEach(function(e) {
if (e == 'id' && data[e] == id) f = data;
})
if (f != null) {
result.push(f);
} else {
Object.keys(data).forEach(function(key) {
if (typeof data[key] == 'object') {
result = result.concat(findObj(data[key], id));
}
})
}
}
return result;
}
console.log(findObj(obj, 'grp1'))
console.log(findObj(obj, 'chart1'))
console.log(findObj(obj, 'cat1'))
。
example.ldif的内容是:
ldapadd -x -D 'cn=root,dc=example,dc=com' -W -f example.ldif