@magda/acs-cmd 1.1.0-alpha.2 → 1.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env node
2
+ (function webpackUniversalModuleDefinition(root, factory) {
3
+ if(typeof exports === 'object' && typeof module === 'object')
4
+ module.exports = factory();
5
+ else if(typeof define === 'function' && define.amd)
6
+ define([], factory);
7
+ else {
8
+ var a = factory();
9
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
10
+ }
11
+ })(global, function() {
12
+ return /******/ (function(modules) { // webpackBootstrap
13
+ /******/ // The module cache
14
+ /******/ var installedModules = {};
15
+ /******/
16
+ /******/ // The require function
17
+ /******/ function __webpack_require__(moduleId) {
18
+ /******/
19
+ /******/ // Check if module is in cache
20
+ /******/ if(installedModules[moduleId]) {
21
+ /******/ return installedModules[moduleId].exports;
22
+ /******/ }
23
+ /******/ // Create a new module (and put it into the cache)
24
+ /******/ var module = installedModules[moduleId] = {
25
+ /******/ i: moduleId,
26
+ /******/ l: false,
27
+ /******/ exports: {}
28
+ /******/ };
29
+ /******/
30
+ /******/ // Execute the module function
31
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32
+ /******/
33
+ /******/ // Flag the module as loaded
34
+ /******/ module.l = true;
35
+ /******/
36
+ /******/ // Return the exports of the module
37
+ /******/ return module.exports;
38
+ /******/ }
39
+ /******/
40
+ /******/
41
+ /******/ // expose the modules object (__webpack_modules__)
42
+ /******/ __webpack_require__.m = modules;
43
+ /******/
44
+ /******/ // expose the module cache
45
+ /******/ __webpack_require__.c = installedModules;
46
+ /******/
47
+ /******/ // define getter function for harmony exports
48
+ /******/ __webpack_require__.d = function(exports, name, getter) {
49
+ /******/ if(!__webpack_require__.o(exports, name)) {
50
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
51
+ /******/ }
52
+ /******/ };
53
+ /******/
54
+ /******/ // define __esModule on exports
55
+ /******/ __webpack_require__.r = function(exports) {
56
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
57
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58
+ /******/ }
59
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
60
+ /******/ };
61
+ /******/
62
+ /******/ // create a fake namespace object
63
+ /******/ // mode & 1: value is a module id, require it
64
+ /******/ // mode & 2: merge all properties of value into the ns
65
+ /******/ // mode & 4: return value when already ns object
66
+ /******/ // mode & 8|1: behave like require
67
+ /******/ __webpack_require__.t = function(value, mode) {
68
+ /******/ if(mode & 1) value = __webpack_require__(value);
69
+ /******/ if(mode & 8) return value;
70
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
71
+ /******/ var ns = Object.create(null);
72
+ /******/ __webpack_require__.r(ns);
73
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
74
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
75
+ /******/ return ns;
76
+ /******/ };
77
+ /******/
78
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
79
+ /******/ __webpack_require__.n = function(module) {
80
+ /******/ var getter = module && module.__esModule ?
81
+ /******/ function getDefault() { return module['default']; } :
82
+ /******/ function getModuleExports() { return module; };
83
+ /******/ __webpack_require__.d(getter, 'a', getter);
84
+ /******/ return getter;
85
+ /******/ };
86
+ /******/
87
+ /******/ // Object.prototype.hasOwnProperty.call
88
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
89
+ /******/
90
+ /******/ // __webpack_public_path__
91
+ /******/ __webpack_require__.p = "";
92
+ /******/
93
+ /******/
94
+ /******/ // Load entry module and return exports
95
+ /******/ return __webpack_require__(__webpack_require__.s = 9);
96
+ /******/ })
97
+ /************************************************************************/
98
+ /******/ ([
99
+ /* 0 */
100
+ /***/ (function(module, exports) {
101
+
102
+ module.exports = require("../../package.json");
103
+
104
+ /***/ }),
105
+ /* 1 */
106
+ /***/ (function(module, exports) {
107
+
108
+ module.exports = require("commander");
109
+
110
+ /***/ }),
111
+ /* 2 */
112
+ /***/ (function(module, exports) {
113
+
114
+ module.exports = require("chalk");
115
+
116
+ /***/ }),
117
+ /* 3 */
118
+ /***/ (function(module, exports, __webpack_require__) {
119
+
120
+ const pg = __webpack_require__(4);
121
+ const getDBConfig = __webpack_require__(5);
122
+
123
+ const pool = new pg.Pool(getDBConfig());
124
+ pool.on("error", function (err, client) {
125
+ console.error("DB Pool Error: ", err.message, err.stack);
126
+ });
127
+
128
+ function getDBPool() {
129
+ return pool;
130
+ }
131
+
132
+ module.exports = getDBPool;
133
+
134
+
135
+ /***/ }),
136
+ /* 4 */
137
+ /***/ (function(module, exports) {
138
+
139
+ module.exports = require("pg");
140
+
141
+ /***/ }),
142
+ /* 5 */
143
+ /***/ (function(module, exports) {
144
+
145
+ function getDBConfig() {
146
+ const {
147
+ POSTGRES_HOST: host,
148
+ POSTGRES_DB: database,
149
+ POSTGRES_USER: user,
150
+ POSTGRES_PASSWORD: password,
151
+ POSTGRES_PORT: port
152
+ } = process.env;
153
+
154
+ return {
155
+ host: host ? host : "localhost",
156
+ database: database ? database : "auth",
157
+ port: port ? port : 5432,
158
+ user: user ? user : "postgres",
159
+ password: password ? password : ""
160
+ };
161
+ }
162
+
163
+ module.exports = getDBConfig;
164
+
165
+
166
+ /***/ }),
167
+ /* 6 */
168
+ /***/ (function(module, exports) {
169
+
170
+ async function recordExist(pool, table, record) {
171
+ if (!Object.keys(record).length) {
172
+ throw new Error("record cannot be an empty object!");
173
+ }
174
+ const sqlValues = [];
175
+ const where = Object.keys(record)
176
+ .map((key) => {
177
+ sqlValues.push(record[key]);
178
+ return `"${key}" = $${sqlValues.length}`;
179
+ })
180
+ .join(" AND ");
181
+ const result = await pool.query(
182
+ `SELECT id FROM "${table}" WHERE ${where}`,
183
+ sqlValues
184
+ );
185
+ if (!result || !result.rows || !result.rows.length) {
186
+ return false;
187
+ }
188
+ return true;
189
+ }
190
+
191
+ const ADMIN_ROLE_ID = "00000000-0000-0003-0000-000000000000";
192
+
193
+ module.exports.recordExist = recordExist;
194
+ module.exports.ADMIN_ROLE_ID = ADMIN_ROLE_ID;
195
+
196
+
197
+ /***/ }),
198
+ /* 7 */,
199
+ /* 8 */,
200
+ /* 9 */
201
+ /***/ (function(module, exports, __webpack_require__) {
202
+
203
+
204
+ const pkg = __webpack_require__(0);
205
+ const program = __webpack_require__(1);
206
+ const chalk = __webpack_require__(2);
207
+ const getDBPool = __webpack_require__(3);
208
+ const { recordExist, ADMIN_ROLE_ID } = __webpack_require__(6);
209
+
210
+ const pool = getDBPool();
211
+
212
+ program
213
+ .description("Make a user an Admin user")
214
+ .option("<userId>", "User ID")
215
+ .version(pkg.version)
216
+ .action(async (userId) => {
217
+ try {
218
+ if (process.argv.slice(2).length < 1) {
219
+ program.help();
220
+ }
221
+ if (!(await recordExist(pool, "users", { id: userId }))) {
222
+ throw new Error(`Supplied userId: ${userId} doesn't exist`);
223
+ }
224
+ if (
225
+ !(await recordExist(pool, "user_roles", {
226
+ role_id: ADMIN_ROLE_ID,
227
+ user_id: userId
228
+ }))
229
+ ) {
230
+ await pool.query(
231
+ `INSERT INTO "user_roles" ("role_id", "user_id") VALUES ($1, $2)`,
232
+ [ADMIN_ROLE_ID, userId]
233
+ );
234
+ }
235
+
236
+ await pool.query(
237
+ `UPDATE "users" SET "isAdmin" = $1 WHERE "id" = $2`,
238
+ [true, userId]
239
+ );
240
+ console.log(chalk.green("Operation Completed!"));
241
+ } catch (e) {
242
+ console.error(chalk.red(`Error: ${e}`));
243
+ }
244
+ process.exit(0);
245
+ })
246
+ .parse(process.argv);
247
+
248
+
249
+ /***/ })
250
+ /******/ ]);
251
+ });
@@ -0,0 +1,252 @@
1
+ #!/usr/bin/env node
2
+ (function webpackUniversalModuleDefinition(root, factory) {
3
+ if(typeof exports === 'object' && typeof module === 'object')
4
+ module.exports = factory();
5
+ else if(typeof define === 'function' && define.amd)
6
+ define([], factory);
7
+ else {
8
+ var a = factory();
9
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
10
+ }
11
+ })(global, function() {
12
+ return /******/ (function(modules) { // webpackBootstrap
13
+ /******/ // The module cache
14
+ /******/ var installedModules = {};
15
+ /******/
16
+ /******/ // The require function
17
+ /******/ function __webpack_require__(moduleId) {
18
+ /******/
19
+ /******/ // Check if module is in cache
20
+ /******/ if(installedModules[moduleId]) {
21
+ /******/ return installedModules[moduleId].exports;
22
+ /******/ }
23
+ /******/ // Create a new module (and put it into the cache)
24
+ /******/ var module = installedModules[moduleId] = {
25
+ /******/ i: moduleId,
26
+ /******/ l: false,
27
+ /******/ exports: {}
28
+ /******/ };
29
+ /******/
30
+ /******/ // Execute the module function
31
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32
+ /******/
33
+ /******/ // Flag the module as loaded
34
+ /******/ module.l = true;
35
+ /******/
36
+ /******/ // Return the exports of the module
37
+ /******/ return module.exports;
38
+ /******/ }
39
+ /******/
40
+ /******/
41
+ /******/ // expose the modules object (__webpack_modules__)
42
+ /******/ __webpack_require__.m = modules;
43
+ /******/
44
+ /******/ // expose the module cache
45
+ /******/ __webpack_require__.c = installedModules;
46
+ /******/
47
+ /******/ // define getter function for harmony exports
48
+ /******/ __webpack_require__.d = function(exports, name, getter) {
49
+ /******/ if(!__webpack_require__.o(exports, name)) {
50
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
51
+ /******/ }
52
+ /******/ };
53
+ /******/
54
+ /******/ // define __esModule on exports
55
+ /******/ __webpack_require__.r = function(exports) {
56
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
57
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58
+ /******/ }
59
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
60
+ /******/ };
61
+ /******/
62
+ /******/ // create a fake namespace object
63
+ /******/ // mode & 1: value is a module id, require it
64
+ /******/ // mode & 2: merge all properties of value into the ns
65
+ /******/ // mode & 4: return value when already ns object
66
+ /******/ // mode & 8|1: behave like require
67
+ /******/ __webpack_require__.t = function(value, mode) {
68
+ /******/ if(mode & 1) value = __webpack_require__(value);
69
+ /******/ if(mode & 8) return value;
70
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
71
+ /******/ var ns = Object.create(null);
72
+ /******/ __webpack_require__.r(ns);
73
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
74
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
75
+ /******/ return ns;
76
+ /******/ };
77
+ /******/
78
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
79
+ /******/ __webpack_require__.n = function(module) {
80
+ /******/ var getter = module && module.__esModule ?
81
+ /******/ function getDefault() { return module['default']; } :
82
+ /******/ function getModuleExports() { return module; };
83
+ /******/ __webpack_require__.d(getter, 'a', getter);
84
+ /******/ return getter;
85
+ /******/ };
86
+ /******/
87
+ /******/ // Object.prototype.hasOwnProperty.call
88
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
89
+ /******/
90
+ /******/ // __webpack_public_path__
91
+ /******/ __webpack_require__.p = "";
92
+ /******/
93
+ /******/
94
+ /******/ // Load entry module and return exports
95
+ /******/ return __webpack_require__(__webpack_require__.s = 10);
96
+ /******/ })
97
+ /************************************************************************/
98
+ /******/ ([
99
+ /* 0 */
100
+ /***/ (function(module, exports) {
101
+
102
+ module.exports = require("../../package.json");
103
+
104
+ /***/ }),
105
+ /* 1 */
106
+ /***/ (function(module, exports) {
107
+
108
+ module.exports = require("commander");
109
+
110
+ /***/ }),
111
+ /* 2 */
112
+ /***/ (function(module, exports) {
113
+
114
+ module.exports = require("chalk");
115
+
116
+ /***/ }),
117
+ /* 3 */
118
+ /***/ (function(module, exports, __webpack_require__) {
119
+
120
+ const pg = __webpack_require__(4);
121
+ const getDBConfig = __webpack_require__(5);
122
+
123
+ const pool = new pg.Pool(getDBConfig());
124
+ pool.on("error", function (err, client) {
125
+ console.error("DB Pool Error: ", err.message, err.stack);
126
+ });
127
+
128
+ function getDBPool() {
129
+ return pool;
130
+ }
131
+
132
+ module.exports = getDBPool;
133
+
134
+
135
+ /***/ }),
136
+ /* 4 */
137
+ /***/ (function(module, exports) {
138
+
139
+ module.exports = require("pg");
140
+
141
+ /***/ }),
142
+ /* 5 */
143
+ /***/ (function(module, exports) {
144
+
145
+ function getDBConfig() {
146
+ const {
147
+ POSTGRES_HOST: host,
148
+ POSTGRES_DB: database,
149
+ POSTGRES_USER: user,
150
+ POSTGRES_PASSWORD: password,
151
+ POSTGRES_PORT: port
152
+ } = process.env;
153
+
154
+ return {
155
+ host: host ? host : "localhost",
156
+ database: database ? database : "auth",
157
+ port: port ? port : 5432,
158
+ user: user ? user : "postgres",
159
+ password: password ? password : ""
160
+ };
161
+ }
162
+
163
+ module.exports = getDBConfig;
164
+
165
+
166
+ /***/ }),
167
+ /* 6 */
168
+ /***/ (function(module, exports) {
169
+
170
+ async function recordExist(pool, table, record) {
171
+ if (!Object.keys(record).length) {
172
+ throw new Error("record cannot be an empty object!");
173
+ }
174
+ const sqlValues = [];
175
+ const where = Object.keys(record)
176
+ .map((key) => {
177
+ sqlValues.push(record[key]);
178
+ return `"${key}" = $${sqlValues.length}`;
179
+ })
180
+ .join(" AND ");
181
+ const result = await pool.query(
182
+ `SELECT id FROM "${table}" WHERE ${where}`,
183
+ sqlValues
184
+ );
185
+ if (!result || !result.rows || !result.rows.length) {
186
+ return false;
187
+ }
188
+ return true;
189
+ }
190
+
191
+ const ADMIN_ROLE_ID = "00000000-0000-0003-0000-000000000000";
192
+
193
+ module.exports.recordExist = recordExist;
194
+ module.exports.ADMIN_ROLE_ID = ADMIN_ROLE_ID;
195
+
196
+
197
+ /***/ }),
198
+ /* 7 */,
199
+ /* 8 */,
200
+ /* 9 */,
201
+ /* 10 */
202
+ /***/ (function(module, exports, __webpack_require__) {
203
+
204
+
205
+ const pkg = __webpack_require__(0);
206
+ const program = __webpack_require__(1);
207
+ const chalk = __webpack_require__(2);
208
+ const getDBPool = __webpack_require__(3);
209
+ const { recordExist, ADMIN_ROLE_ID } = __webpack_require__(6);
210
+
211
+ const pool = getDBPool();
212
+
213
+ program
214
+ .description("Remove Admin role / status from a user")
215
+ .option("<userId>", "User ID")
216
+ .version(pkg.version)
217
+ .action(async (userId) => {
218
+ try {
219
+ if (process.argv.slice(2).length < 1) {
220
+ program.help();
221
+ }
222
+ if (!(await recordExist(pool, "users", { id: userId }))) {
223
+ throw new Error(`Supplied userId: ${userId} doesn't exist`);
224
+ }
225
+ if (
226
+ await recordExist(pool, "user_roles", {
227
+ role_id: ADMIN_ROLE_ID,
228
+ user_id: userId
229
+ })
230
+ ) {
231
+ await pool.query(
232
+ `DELETE FROM "user_roles" WHERE "role_id" = $1 AND "user_id" = $2`,
233
+ [ADMIN_ROLE_ID, userId]
234
+ );
235
+ }
236
+
237
+ await pool.query(
238
+ `UPDATE "users" SET "isAdmin"=$1 WHERE "id" = $2`,
239
+ [false, userId]
240
+ );
241
+ console.log(chalk.green("Operation Completed!"));
242
+ } catch (e) {
243
+ console.error(chalk.red(`Error: ${e}`));
244
+ }
245
+ process.exit(0);
246
+ })
247
+ .parse(process.argv);
248
+
249
+
250
+ /***/ })
251
+ /******/ ]);
252
+ });
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env node
2
+ (function webpackUniversalModuleDefinition(root, factory) {
3
+ if(typeof exports === 'object' && typeof module === 'object')
4
+ module.exports = factory();
5
+ else if(typeof define === 'function' && define.amd)
6
+ define([], factory);
7
+ else {
8
+ var a = factory();
9
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
10
+ }
11
+ })(global, function() {
12
+ return /******/ (function(modules) { // webpackBootstrap
13
+ /******/ // The module cache
14
+ /******/ var installedModules = {};
15
+ /******/
16
+ /******/ // The require function
17
+ /******/ function __webpack_require__(moduleId) {
18
+ /******/
19
+ /******/ // Check if module is in cache
20
+ /******/ if(installedModules[moduleId]) {
21
+ /******/ return installedModules[moduleId].exports;
22
+ /******/ }
23
+ /******/ // Create a new module (and put it into the cache)
24
+ /******/ var module = installedModules[moduleId] = {
25
+ /******/ i: moduleId,
26
+ /******/ l: false,
27
+ /******/ exports: {}
28
+ /******/ };
29
+ /******/
30
+ /******/ // Execute the module function
31
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32
+ /******/
33
+ /******/ // Flag the module as loaded
34
+ /******/ module.l = true;
35
+ /******/
36
+ /******/ // Return the exports of the module
37
+ /******/ return module.exports;
38
+ /******/ }
39
+ /******/
40
+ /******/
41
+ /******/ // expose the modules object (__webpack_modules__)
42
+ /******/ __webpack_require__.m = modules;
43
+ /******/
44
+ /******/ // expose the module cache
45
+ /******/ __webpack_require__.c = installedModules;
46
+ /******/
47
+ /******/ // define getter function for harmony exports
48
+ /******/ __webpack_require__.d = function(exports, name, getter) {
49
+ /******/ if(!__webpack_require__.o(exports, name)) {
50
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
51
+ /******/ }
52
+ /******/ };
53
+ /******/
54
+ /******/ // define __esModule on exports
55
+ /******/ __webpack_require__.r = function(exports) {
56
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
57
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58
+ /******/ }
59
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
60
+ /******/ };
61
+ /******/
62
+ /******/ // create a fake namespace object
63
+ /******/ // mode & 1: value is a module id, require it
64
+ /******/ // mode & 2: merge all properties of value into the ns
65
+ /******/ // mode & 4: return value when already ns object
66
+ /******/ // mode & 8|1: behave like require
67
+ /******/ __webpack_require__.t = function(value, mode) {
68
+ /******/ if(mode & 1) value = __webpack_require__(value);
69
+ /******/ if(mode & 8) return value;
70
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
71
+ /******/ var ns = Object.create(null);
72
+ /******/ __webpack_require__.r(ns);
73
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
74
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
75
+ /******/ return ns;
76
+ /******/ };
77
+ /******/
78
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
79
+ /******/ __webpack_require__.n = function(module) {
80
+ /******/ var getter = module && module.__esModule ?
81
+ /******/ function getDefault() { return module['default']; } :
82
+ /******/ function getModuleExports() { return module; };
83
+ /******/ __webpack_require__.d(getter, 'a', getter);
84
+ /******/ return getter;
85
+ /******/ };
86
+ /******/
87
+ /******/ // Object.prototype.hasOwnProperty.call
88
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
89
+ /******/
90
+ /******/ // __webpack_public_path__
91
+ /******/ __webpack_require__.p = "";
92
+ /******/
93
+ /******/
94
+ /******/ // Load entry module and return exports
95
+ /******/ return __webpack_require__(__webpack_require__.s = 11);
96
+ /******/ })
97
+ /************************************************************************/
98
+ /******/ ([
99
+ /* 0 */
100
+ /***/ (function(module, exports) {
101
+
102
+ module.exports = require("../../package.json");
103
+
104
+ /***/ }),
105
+ /* 1 */
106
+ /***/ (function(module, exports) {
107
+
108
+ module.exports = require("commander");
109
+
110
+ /***/ }),
111
+ /* 2 */
112
+ /***/ (function(module, exports) {
113
+
114
+ module.exports = require("chalk");
115
+
116
+ /***/ }),
117
+ /* 3 */,
118
+ /* 4 */,
119
+ /* 5 */,
120
+ /* 6 */,
121
+ /* 7 */,
122
+ /* 8 */,
123
+ /* 9 */,
124
+ /* 10 */,
125
+ /* 11 */
126
+ /***/ (function(module, exports, __webpack_require__) {
127
+
128
+
129
+ const pkg = __webpack_require__(0);
130
+ const program = __webpack_require__(1);
131
+ const chalk = __webpack_require__(2);
132
+
133
+ program
134
+ .version(pkg.version)
135
+ .description(
136
+ `A tool for setting / unsetting Admin role / status to a user. Version: ${pkg.version} \n` +
137
+ `Hint: Use 'acs-cmd list users' command to list all users in systemp`
138
+ )
139
+ .command("set <userId>", "Make a user an admin user")
140
+ .command("unset <userId>", "Remove admin role / status from a user")
141
+ .on("command:*", function (cmds) {
142
+ if (["set", "unset"].indexOf(cmds[0]) === -1) {
143
+ console.error(
144
+ chalk.red(
145
+ `Invalid command: ${program.args.join(
146
+ " "
147
+ )}\nSee --help for a list of available commands.`
148
+ )
149
+ );
150
+ process.exit(1);
151
+ }
152
+ })
153
+ .parse(process.argv);
154
+
155
+
156
+ /***/ })
157
+ /******/ ]);
158
+ });