2
0
Fork 0

Last open WIP commit to see ldap action.

This commit is contained in:
Willem Cazander 2020-12-01 14:23:29 +01:00
parent 3f929f9607
commit 4c72e7a5f8
7 changed files with 923 additions and 654 deletions

View file

@ -1,25 +1,35 @@
var ldap = require('ldapjs');
module.exports = {
load: load,
setup: setup
};
function setup(tcrud,tcrudModel) {
function load(tcrud) {
var client = ldap.createClient({
url: 'ldap://127.0.0.1:389'
});
client.bind('cn=admin,dc=test,dc=net', 'test', function(err) {
if (err) {
console.log('bind eror: '+err);
} else {
console.log('bind oke');
}
});
// Create backend with id and uri
tcrud.plugin.backend.ldapjs.registrate('ldapjs/main',client);
tcrud.backend.ldapjs.registrate('ldapjs/main',client);
}
function setup(tcrud,tcrudModel) {
// 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 tUser = tc.createTEntity(t,'test_users','cn');
var tUserId = tc.createTField(tUser,'uid');
var tUserName = tc.createTField(tUser,'sn');
var tUserEmail = tc.createTField(tUser,'email');