Last open WIP commit to see ldap action.
This commit is contained in:
parent
3f929f9607
commit
4c72e7a5f8
7 changed files with 923 additions and 654 deletions
|
|
@ -1,9 +1,9 @@
|
|||
var config = require('./../tcrud-config');
|
||||
var tcrudSetup = require('./../tcrud-setup');
|
||||
var debug = require('debug')('ff:tcrud:ldapjs');
|
||||
|
||||
module.exports = {
|
||||
registrate: function(key,client) {
|
||||
config.registratePlugin(new LdapJSPlugin(key,client));
|
||||
tcrudSetup.pluginLoad(new LdapJSPlugin(key,client));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -33,15 +33,18 @@ LdapJSBackend.prototype.getKey = function() {
|
|||
return this.plugin.key;
|
||||
}
|
||||
|
||||
// see http://ldapjs.org/client.html#connection-management
|
||||
LdapJSBackend.prototype.findAll = function(tview,crudType) {
|
||||
var self = this;
|
||||
return function(data, dataParam, cb) {
|
||||
var opts = {
|
||||
filter: '(&(l=Seattle)(email=*@foo.com))',
|
||||
filter2: '(&(l=Seattle)(email=*@foo.com))',
|
||||
scope: 'sub'
|
||||
};
|
||||
debug('findAll %s',opts);
|
||||
self.plugin.client.search('o=example', opts, function(err, res) {
|
||||
var ss = 'ou=users,dc=nss,dc=forwardfire,dc=net';
|
||||
console.log("ldap search "+ss);
|
||||
self.plugin.client.search(ss, opts, function(err, res) {
|
||||
if (err) {
|
||||
debug(err);
|
||||
cb(err);
|
||||
|
|
@ -50,9 +53,12 @@ LdapJSBackend.prototype.findAll = function(tview,crudType) {
|
|||
//var querySql = 'SELECT '+selectField(tview,crudType)+' FROM '+tview.tmeta.tmodel.tid+'';
|
||||
var result = [];
|
||||
res.on('searchEntry', function(entry) {
|
||||
result.push(entry);
|
||||
result.push(entry.object);
|
||||
});
|
||||
res.on('end', function(result) {
|
||||
res.on('error', function(err) {
|
||||
cb(err);
|
||||
});
|
||||
res.on('end', function(status) {
|
||||
cb(err,result);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ var mod = (function () {
|
|||
'fillTField',
|
||||
'fillTView',
|
||||
'createBackend',
|
||||
'key','dbModule','query','conn'];
|
||||
'key','dbModule','client','query','conn'];
|
||||
|
||||
|
||||
var mergeMaster = function(objectDest,pluginKey) {
|
||||
|
|
@ -192,7 +192,7 @@ var mod = (function () {
|
|||
if (pluginKeysAllowed.indexOf(objectKey) !== -1) {
|
||||
continue;
|
||||
}
|
||||
throw new Error('Illegal plugin objectKey: '+objectKey+' plugin: '+plugin.tmeta.key);
|
||||
throw new Error('Illegal plugin objectKey: '+objectKey+' plugin: '+plugin);
|
||||
}
|
||||
|
||||
plugin['tmeta'] = ctx;
|
||||
|
|
@ -385,16 +385,17 @@ var mod = (function () {
|
|||
|
||||
this.createClientResourceFetchList = function() {
|
||||
var fetchList = [];
|
||||
var serverUrl = "http://localhost:8080";
|
||||
for (var clientResourceIdx in masterConfig.clientResources.js) {
|
||||
var url = masterConfig.clientResources.js[clientResourceIdx];
|
||||
var url = serverUrl + masterConfig.clientResources.js[clientResourceIdx];
|
||||
fetchList.push({url:url,type:'js'});
|
||||
}
|
||||
for (var clientResourceIdx in masterConfig.clientResources.css) {
|
||||
var url = masterConfig.clientResources.css[clientResourceIdx];
|
||||
var url = serverUrl + masterConfig.clientResources.css[clientResourceIdx];
|
||||
fetchList.push({url:url,type:'css'});
|
||||
}
|
||||
for (var clientResourceIdx in masterConfig.clientResources.dss) {
|
||||
var url = masterConfig.clientResources.dss[clientResourceIdx];
|
||||
var url = serverUrl + masterConfig.clientResources.dss[clientResourceIdx];
|
||||
fetchList.push({url:url,type:'dss'});
|
||||
}
|
||||
return fetchList;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue