Merge pull request #1807 from thelounge/astorije/users-commands

Do not load user commands or display them on `--help` if public mode or using LDAP
This commit is contained in:
Jérémie Astori 2017-12-10 14:24:55 -05:00 committed by GitHub
commit c0869b05a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 35 deletions

View File

@ -51,11 +51,9 @@ Helper.setHome(home);
require("./start");
require("./config");
require("./list");
require("./add");
require("./remove");
require("./reset");
require("./edit");
if (!Helper.config.public && !Helper.config.ldap.enable) {
require("./users");
}
require("./install");
// TODO: Remove this when releasing The Lounge v3

View File

@ -3,8 +3,8 @@
const colors = require("colors/safe");
const program = require("commander");
const fs = require("fs");
const Helper = require("../helper");
const Utils = require("./utils");
const Helper = require("../../helper");
const Utils = require("../utils");
program
.command("add <name>")
@ -16,12 +16,7 @@ program
return;
}
const ClientManager = require("../clientManager");
if (Helper.config.public) {
log.warn(`Users have no effect in ${colors.bold("public")} mode.`);
}
const ClientManager = require("../../clientManager");
const manager = new ClientManager();
const users = manager.getUsers();

View File

@ -4,8 +4,8 @@ const program = require("commander");
const child = require("child_process");
const colors = require("colors/safe");
const fs = require("fs");
const Helper = require("../helper");
const Utils = require("./utils");
const Helper = require("../../helper");
const Utils = require("../utils");
program
.command("edit <name>")
@ -17,9 +17,8 @@ program
return;
}
const ClientManager = require("../clientManager");
var users = new ClientManager().getUsers();
const ClientManager = require("../../clientManager");
const users = new ClientManager().getUsers();
if (users === undefined) { // There was an error, already logged
return;

View File

@ -0,0 +1,7 @@
"use strict";
require("./list");
require("./add");
require("./remove");
require("./reset");
require("./edit");

View File

@ -3,8 +3,8 @@
const colors = require("colors/safe");
const program = require("commander");
const fs = require("fs");
const Helper = require("../helper");
const Utils = require("./utils");
const Helper = require("../../helper");
const Utils = require("../utils");
program
.command("list")
@ -16,13 +16,8 @@ program
return;
}
const ClientManager = require("../clientManager");
if (Helper.config.public) {
log.warn(`Users have no effect in ${colors.bold("public")} mode.`);
}
var users = new ClientManager().getUsers();
const ClientManager = require("../../clientManager");
const users = new ClientManager().getUsers();
if (users === undefined) { // There was an error, already logged
return;

View File

@ -3,8 +3,8 @@
const colors = require("colors/safe");
const program = require("commander");
const fs = require("fs");
const Helper = require("../helper");
const Utils = require("./utils");
const Helper = require("../../helper");
const Utils = require("../utils");
program
.command("remove <name>")
@ -16,7 +16,7 @@ program
return;
}
const ClientManager = require("../clientManager");
const ClientManager = require("../../clientManager");
const manager = new ClientManager();
try {

View File

@ -3,8 +3,8 @@
const colors = require("colors/safe");
const program = require("commander");
const fs = require("fs");
const Helper = require("../helper");
const Utils = require("./utils");
const Helper = require("../../helper");
const Utils = require("../utils");
program
.command("reset <name>")
@ -16,9 +16,8 @@ program
return;
}
const ClientManager = require("../clientManager");
var users = new ClientManager().getUsers();
const ClientManager = require("../../clientManager");
const users = new ClientManager().getUsers();
if (users === undefined) { // There was an error, already logged
return;