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 bcrypt = require("bcrypt-nodejs");
var fs = require("fs");
var program = require("commander");
var mkdirp = require("mkdirp");
var Helper = require("../helper");
@ -12,17 +11,6 @@ program
try {
mkdirp.sync(Helper.USERS_PATH);
} 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);
return;
}

View File

@ -1,21 +1,10 @@
var ClientManager = new require("../clientManager");
var fs = require("fs");
var program = require("commander");
var Helper = require("../helper");
program
.command("remove <name>")
.description("Remove an existing user")
.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();
if (manager.removeUser(name)) {
log.info("Removed user '" + name + "'.");