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:
commit
c0869b05a3
@ -51,11 +51,9 @@ Helper.setHome(home);
|
|||||||
|
|
||||||
require("./start");
|
require("./start");
|
||||||
require("./config");
|
require("./config");
|
||||||
require("./list");
|
if (!Helper.config.public && !Helper.config.ldap.enable) {
|
||||||
require("./add");
|
require("./users");
|
||||||
require("./remove");
|
}
|
||||||
require("./reset");
|
|
||||||
require("./edit");
|
|
||||||
require("./install");
|
require("./install");
|
||||||
|
|
||||||
// TODO: Remove this when releasing The Lounge v3
|
// TODO: Remove this when releasing The Lounge v3
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
const colors = require("colors/safe");
|
const colors = require("colors/safe");
|
||||||
const program = require("commander");
|
const program = require("commander");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const Helper = require("../helper");
|
const Helper = require("../../helper");
|
||||||
const Utils = require("./utils");
|
const Utils = require("../utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("add <name>")
|
.command("add <name>")
|
||||||
@ -16,12 +16,7 @@ program
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClientManager = require("../clientManager");
|
const ClientManager = require("../../clientManager");
|
||||||
|
|
||||||
if (Helper.config.public) {
|
|
||||||
log.warn(`Users have no effect in ${colors.bold("public")} mode.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const manager = new ClientManager();
|
const manager = new ClientManager();
|
||||||
const users = manager.getUsers();
|
const users = manager.getUsers();
|
||||||
|
|
@ -4,8 +4,8 @@ const program = require("commander");
|
|||||||
const child = require("child_process");
|
const child = require("child_process");
|
||||||
const colors = require("colors/safe");
|
const colors = require("colors/safe");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const Helper = require("../helper");
|
const Helper = require("../../helper");
|
||||||
const Utils = require("./utils");
|
const Utils = require("../utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("edit <name>")
|
.command("edit <name>")
|
||||||
@ -17,9 +17,8 @@ program
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClientManager = require("../clientManager");
|
const ClientManager = require("../../clientManager");
|
||||||
|
const users = new ClientManager().getUsers();
|
||||||
var users = new ClientManager().getUsers();
|
|
||||||
|
|
||||||
if (users === undefined) { // There was an error, already logged
|
if (users === undefined) { // There was an error, already logged
|
||||||
return;
|
return;
|
7
src/command-line/users/index.js
Normal file
7
src/command-line/users/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
require("./list");
|
||||||
|
require("./add");
|
||||||
|
require("./remove");
|
||||||
|
require("./reset");
|
||||||
|
require("./edit");
|
@ -3,8 +3,8 @@
|
|||||||
const colors = require("colors/safe");
|
const colors = require("colors/safe");
|
||||||
const program = require("commander");
|
const program = require("commander");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const Helper = require("../helper");
|
const Helper = require("../../helper");
|
||||||
const Utils = require("./utils");
|
const Utils = require("../utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("list")
|
.command("list")
|
||||||
@ -16,13 +16,8 @@ program
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClientManager = require("../clientManager");
|
const ClientManager = require("../../clientManager");
|
||||||
|
const users = new ClientManager().getUsers();
|
||||||
if (Helper.config.public) {
|
|
||||||
log.warn(`Users have no effect in ${colors.bold("public")} mode.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
var users = new ClientManager().getUsers();
|
|
||||||
|
|
||||||
if (users === undefined) { // There was an error, already logged
|
if (users === undefined) { // There was an error, already logged
|
||||||
return;
|
return;
|
@ -3,8 +3,8 @@
|
|||||||
const colors = require("colors/safe");
|
const colors = require("colors/safe");
|
||||||
const program = require("commander");
|
const program = require("commander");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const Helper = require("../helper");
|
const Helper = require("../../helper");
|
||||||
const Utils = require("./utils");
|
const Utils = require("../utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("remove <name>")
|
.command("remove <name>")
|
||||||
@ -16,7 +16,7 @@ program
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClientManager = require("../clientManager");
|
const ClientManager = require("../../clientManager");
|
||||||
const manager = new ClientManager();
|
const manager = new ClientManager();
|
||||||
|
|
||||||
try {
|
try {
|
@ -3,8 +3,8 @@
|
|||||||
const colors = require("colors/safe");
|
const colors = require("colors/safe");
|
||||||
const program = require("commander");
|
const program = require("commander");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const Helper = require("../helper");
|
const Helper = require("../../helper");
|
||||||
const Utils = require("./utils");
|
const Utils = require("../utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("reset <name>")
|
.command("reset <name>")
|
||||||
@ -16,9 +16,8 @@ program
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClientManager = require("../clientManager");
|
const ClientManager = require("../../clientManager");
|
||||||
|
const users = new ClientManager().getUsers();
|
||||||
var users = new ClientManager().getUsers();
|
|
||||||
|
|
||||||
if (users === undefined) { // There was an error, already logged
|
if (users === undefined) { // There was an error, already logged
|
||||||
return;
|
return;
|
Loading…
Reference in New Issue
Block a user