lint
This commit is contained in:
@@ -58,7 +58,7 @@ class LdapServer {
|
||||
|
||||
// helper function to deal with pagination taken from ldap.js
|
||||
#finalSend(results, req, res, next) {
|
||||
let min = 0;
|
||||
const min = 0;
|
||||
const max = results.length;
|
||||
let cookie = null;
|
||||
let pageSize = 0;
|
||||
@@ -120,7 +120,7 @@ class LdapServer {
|
||||
this.#ldapServer = ldap.createServer();
|
||||
|
||||
this.#ldapServer.search(LDAP_BASE_DN, (req, res, next) => {
|
||||
let results = [];
|
||||
const results = [];
|
||||
|
||||
this.#users.forEach(function (entry) {
|
||||
const dn = ldap.parseDN(`cn=${entry.username},${LDAP_BASE_DN}`);
|
||||
@@ -144,7 +144,7 @@ class LdapServer {
|
||||
});
|
||||
|
||||
this.#ldapServer.search(LDAP_GROUP_BASE_DN, (req, res, next) => {
|
||||
let results = [];
|
||||
const results = [];
|
||||
|
||||
this.#groups.forEach(function (entry) {
|
||||
const dn = ldap.parseDN(`cn=${entry.groupname},${LDAP_GROUP_BASE_DN}`);
|
||||
@@ -223,7 +223,7 @@ describe('External LDAP', function () {
|
||||
|
||||
describe('settings', function () {
|
||||
it('enabling fails with missing url', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
delete conf.url;
|
||||
|
||||
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
|
||||
@@ -231,7 +231,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling fails with empty url', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.url = '';
|
||||
|
||||
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
|
||||
@@ -239,7 +239,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling fails with missing baseDn', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
delete conf.baseDn;
|
||||
|
||||
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
|
||||
@@ -247,7 +247,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling fails with empty baseDn', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.baseDn = '';
|
||||
|
||||
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
|
||||
@@ -255,7 +255,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling fails with missing filter', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
delete conf.filter;
|
||||
|
||||
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
|
||||
@@ -263,7 +263,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling fails with empty filter', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.filter = '';
|
||||
|
||||
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
|
||||
@@ -280,7 +280,7 @@ describe('External LDAP', function () {
|
||||
|
||||
// now test with groups
|
||||
it('enabling with groups fails with missing groupBaseDn', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
delete conf.groupBaseDn;
|
||||
|
||||
@@ -289,7 +289,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling with groups fails with empty groupBaseDn', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
conf.groupBaseDn = '';
|
||||
|
||||
@@ -298,7 +298,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling with groups fails with missing groupFilter', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
delete conf.groupFilter;
|
||||
|
||||
@@ -307,7 +307,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling with groups fails with empty groupFilter', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
conf.groupFilter = '';
|
||||
|
||||
@@ -316,7 +316,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling with groups fails with missing groupnameField', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
delete conf.groupnameField;
|
||||
|
||||
@@ -325,7 +325,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling with groups fails with empty groupnameField', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
conf.groupnameField = '';
|
||||
|
||||
@@ -334,7 +334,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enabling with groups succeeds', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.syncGroups = true;
|
||||
|
||||
await externalLdap.setConfig(conf, auditSource);
|
||||
@@ -634,7 +634,7 @@ describe('External LDAP', function () {
|
||||
});
|
||||
|
||||
it('enable auto create', async function () {
|
||||
let conf = Object.assign({}, LDAP_CONFIG);
|
||||
const conf = Object.assign({}, LDAP_CONFIG);
|
||||
conf.autoCreate = true;
|
||||
await externalLdap.setConfig(conf, auditSource);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user