shell: make require take a tag

This commit is contained in:
Girish Ramakrishnan
2024-10-14 19:10:31 +02:00
parent 02823c4158
commit a9e1d7641d
27 changed files with 162 additions and 156 deletions
+5 -6
View File
@@ -23,7 +23,7 @@ const assert = require('assert'),
reverseProxy = require('./reverseproxy.js'),
safe = require('safetydance'),
settings = require('./settings.js'),
shell = require('./shell.js'),
shell = require('./shell.js')('directoryserver'),
users = require('./users.js'),
util = require('util'),
validator = require('validator');
@@ -75,7 +75,7 @@ async function applyConfig(config) {
safe.fs.unlinkSync(paths.LDAP_ALLOWLIST_FILE);
}
const [error] = await safe(shell.promises.sudo('setLdapAllowlist', [ SET_LDAP_ALLOWLIST_CMD ], {}));
const [error] = await safe(shell.promises.sudo([ SET_LDAP_ALLOWLIST_CMD ], {}));
if (error) throw new BoxError(BoxError.IPTABLES_ERROR, `Error setting ldap allowlist: ${error.message}`);
if (!config.enabled) {
@@ -109,8 +109,7 @@ async function setConfig(directoryServerConfig, auditSource) {
// helper function to deal with pagination
function finalSend(results, req, res, next) {
let min = 0;
let max = results.length;
const min = 0, max = results.length;
let cookie = null;
let pageSize = 0;
@@ -208,7 +207,7 @@ async function userSearch(req, res, next) {
const [groupsError, allGroups] = await safe(groups.listWithMembers());
if (groupsError) return next(new ldap.OperationsError(groupsError.message));
let results = [];
const results = [];
// send user objects
for (const user of allUsers) {
@@ -263,7 +262,7 @@ async function groupSearch(req, res, next) {
const results = [];
let [errorGroups, allGroups] = await safe(groups.listWithMembers());
const [errorGroups, allGroups] = await safe(groups.listWithMembers());
if (errorGroups) return next(new ldap.OperationsError(errorGroups.message));
for (const group of allGroups) {