mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Merge branch 'ldap_search_filter' of https://github.com/thasegaw/stf into thasegaw-ldap_search_filter
This commit is contained in:
commit
c55b08fbc2
2 changed files with 11 additions and 0 deletions
|
@ -44,6 +44,11 @@ module.exports.builder = function(yargs) {
|
||||||
, type: 'string'
|
, type: 'string'
|
||||||
, default: process.env.LDAP_SEARCH_SCOPE || 'sub'
|
, default: process.env.LDAP_SEARCH_SCOPE || 'sub'
|
||||||
})
|
})
|
||||||
|
.option('ldap-search-filter', {
|
||||||
|
describe: 'LDAP search filter.'
|
||||||
|
, type: 'string'
|
||||||
|
, default: process.env.LDAP_SEARCH_FILTER
|
||||||
|
})
|
||||||
.option('ldap-timeout', {
|
.option('ldap-timeout', {
|
||||||
alias: 't'
|
alias: 't'
|
||||||
, describe: 'LDAP timeout.'
|
, describe: 'LDAP timeout.'
|
||||||
|
@ -110,6 +115,7 @@ module.exports.handler = function(argv) {
|
||||||
, scope: argv.ldapSearchScope
|
, scope: argv.ldapSearchScope
|
||||||
, objectClass: argv.ldapSearchClass
|
, objectClass: argv.ldapSearchClass
|
||||||
, field: argv.ldapSearchField
|
, field: argv.ldapSearchField
|
||||||
|
, filter: argv.ldapSearchFilter
|
||||||
}
|
}
|
||||||
, username: {
|
, username: {
|
||||||
field: argv.ldapUsernameField
|
field: argv.ldapUsernameField
|
||||||
|
|
|
@ -60,6 +60,11 @@ module.exports.login = function(options, username, password) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof options.search.filter !== 'undefined') {
|
||||||
|
var parsedFilter = ldap.parseFilter(options.search.filter)
|
||||||
|
query.filter.filters.push(parsedFilter)
|
||||||
|
}
|
||||||
|
|
||||||
client.search(options.search.dn, query, function(err, search) {
|
client.search(options.search.dn, query, function(err, search) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return resolver.reject(err)
|
return resolver.reject(err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue