2
0
Fork 0
tcrud/example/lib/ldapjs-example.js

27 lines
663 B
JavaScript
Raw Normal View History

2017-06-10 14:53:29 +00:00
var ldap = require('ldapjs');
module.exports = {
setup: setup
};
function setup(tcrud,tcrudModel) {
var client = ldap.createClient({
url: 'ldap://127.0.0.1:389'
});
// Create backend with id and uri
tcrud.plugin.backend.ldapjs.registrate('ldapjs/main',client);
// Create tcrud models
var tc = tcrud.config;
var t = tc.createTEntityNode(tcrudModel,'ldapjs');
t.tmeta.tmodel.tbackend = 'ldapjs/main';
// Define model and columns
var tUser = tc.createTEntity(t,'cn=foo, o=example','cn');
var tUserId = tc.createTField(tUser,'uid');
var tUserName = tc.createTField(tUser,'sn');
var tUserEmail = tc.createTField(tUser,'email');
}