2
0
Fork 0
tcrud/example/lib/ldapjs-example.js
2017-06-10 16:53:29 +02:00

27 lines
663 B
JavaScript

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');
}