Remove permissions test and do not suggest using sudo

This commit is contained in:
Pavel Djundik 2016-05-09 19:00:42 +03:00 committed by Jérémie Astori
parent fe85873f1e
commit d725bf0f70
2 changed files with 0 additions and 23 deletions

View File

@ -1,6 +1,5 @@
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var bcrypt = require("bcrypt-nodejs"); var bcrypt = require("bcrypt-nodejs");
var fs = require("fs");
var program = require("commander"); var program = require("commander");
var mkdirp = require("mkdirp"); var mkdirp = require("mkdirp");
var Helper = require("../helper"); var Helper = require("../helper");
@ -12,17 +11,6 @@ program
try { try {
mkdirp.sync(Helper.USERS_PATH); mkdirp.sync(Helper.USERS_PATH);
} catch (e) { } catch (e) {
log.error("Could not create", Helper.USERS_PATH);
log.info("Try running the command as sudo.");
return;
}
try {
var test = require("path").join(Helper.USERS_PATH, ".test");
fs.mkdirSync(test);
fs.rmdirSync(test);
} catch (e) {
log.error("You have no permissions to write to", Helper.USERS_PATH);
log.info("Try running the command as sudo.");
log.error("Could not create", Helper.USERS_PATH); log.error("Could not create", Helper.USERS_PATH);
return; return;
} }

View File

@ -1,21 +1,10 @@
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var fs = require("fs");
var program = require("commander"); var program = require("commander");
var Helper = require("../helper");
program program
.command("remove <name>") .command("remove <name>")
.description("Remove an existing user") .description("Remove an existing user")
.action(function(name) { .action(function(name) {
try {
var test = require("path").join(Helper.USERS_PATH, ".test");
fs.mkdirSync(test);
fs.rmdirSync(test);
} catch (e) {
log.warn("You have no permissions to delete from " + Helper.USERS_PATH);
log.info("Try running the command as sudo.");
return;
}
var manager = new ClientManager(); var manager = new ClientManager();
if (manager.removeUser(name)) { if (manager.removeUser(name)) {
log.info("Removed user '" + name + "'."); log.info("Removed user '" + name + "'.");