@magda/acs-cmd 2.3.2 → 3.0.0-alpha.0
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.
- package/bin/acs-cmd-admin-set.js +129 -0
- package/bin/acs-cmd-admin-unset.js +129 -0
- package/bin/acs-cmd-admin.js +63 -0
- package/bin/acs-cmd-assign-permission.js +132 -0
- package/bin/acs-cmd-assign-role.js +130 -0
- package/bin/acs-cmd-assign.js +65 -0
- package/bin/acs-cmd-create-operation.js +112 -0
- package/bin/acs-cmd-create-permission.js +93 -0
- package/bin/acs-cmd-create.js +62 -0
- package/bin/acs-cmd-jwt.js +80 -0
- package/bin/acs-cmd-list-permissions.js +139 -0
- package/bin/acs-cmd-list-resources.js +111 -0
- package/bin/acs-cmd-list-roles.js +136 -0
- package/bin/acs-cmd-list-users.js +147 -0
- package/bin/acs-cmd-list.js +62 -0
- package/bin/acs-cmd-remove-permission.js +132 -0
- package/bin/acs-cmd-remove-role.js +130 -0
- package/bin/acs-cmd-remove.js +65 -0
- package/bin/acs-cmd.js +77 -0
- package/bin/utils.js +24 -0
- package/package.json +17 -13
- package/bin/acs-cmd/acs-cmd-admin-set.js +0 -251
- package/bin/acs-cmd/acs-cmd-admin-unset.js +0 -252
- package/bin/acs-cmd/acs-cmd-admin.js +0 -158
- package/bin/acs-cmd/acs-cmd-assign-permission.js +0 -260
- package/bin/acs-cmd/acs-cmd-assign-role.js +0 -257
- package/bin/acs-cmd/acs-cmd-assign.js +0 -157
- package/bin/acs-cmd/acs-cmd-create-operation.js +0 -234
- package/bin/acs-cmd/acs-cmd-create-permission.js +0 -241
- package/bin/acs-cmd/acs-cmd-create.js +0 -154
- package/bin/acs-cmd/acs-cmd-jwt.js +0 -192
- package/bin/acs-cmd/acs-cmd-list-permissions.js +0 -267
- package/bin/acs-cmd/acs-cmd-list-resources.js +0 -241
- package/bin/acs-cmd/acs-cmd-list-roles.js +0 -267
- package/bin/acs-cmd/acs-cmd-list-users.js +0 -271
- package/bin/acs-cmd/acs-cmd-list.js +0 -155
- package/bin/acs-cmd/acs-cmd-remove-permission.js +0 -264
- package/bin/acs-cmd/acs-cmd-remove-role.js +0 -260
- package/bin/acs-cmd/acs-cmd-remove.js +0 -157
- package/bin/acs-cmd/acs-cmd.js +0 -174
- package/bin/acs-cmd/utils.js +0 -133
- package/bin/db/getDBConfig.js +0 -19
- package/bin/db/getDBPool.js +0 -13
|
@@ -1,260 +0,0 @@
|
|
|
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 = 27);
|
|
96
|
-
/******/ })
|
|
97
|
-
/************************************************************************/
|
|
98
|
-
/******/ ({
|
|
99
|
-
|
|
100
|
-
/***/ 0:
|
|
101
|
-
/***/ (function(module, exports) {
|
|
102
|
-
|
|
103
|
-
module.exports = require("../../package.json");
|
|
104
|
-
|
|
105
|
-
/***/ }),
|
|
106
|
-
|
|
107
|
-
/***/ 1:
|
|
108
|
-
/***/ (function(module, exports) {
|
|
109
|
-
|
|
110
|
-
module.exports = require("commander");
|
|
111
|
-
|
|
112
|
-
/***/ }),
|
|
113
|
-
|
|
114
|
-
/***/ 2:
|
|
115
|
-
/***/ (function(module, exports) {
|
|
116
|
-
|
|
117
|
-
module.exports = require("chalk");
|
|
118
|
-
|
|
119
|
-
/***/ }),
|
|
120
|
-
|
|
121
|
-
/***/ 27:
|
|
122
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const pkg = __webpack_require__(0);
|
|
126
|
-
const program = __webpack_require__(1);
|
|
127
|
-
const chalk = __webpack_require__(2);
|
|
128
|
-
const getDBPool = __webpack_require__(3);
|
|
129
|
-
const { recordExist } = __webpack_require__(6);
|
|
130
|
-
|
|
131
|
-
const pool = getDBPool();
|
|
132
|
-
|
|
133
|
-
program
|
|
134
|
-
.description("Remove a role from a user")
|
|
135
|
-
.option("<roleId>", "Role ID")
|
|
136
|
-
.option("<userId>", "User ID")
|
|
137
|
-
.version(pkg.version)
|
|
138
|
-
.action(async (roleId, userId) => {
|
|
139
|
-
try {
|
|
140
|
-
if (process.argv.slice(2).length < 2) {
|
|
141
|
-
program.help();
|
|
142
|
-
}
|
|
143
|
-
if (!(await recordExist(pool, "users", { id: userId }))) {
|
|
144
|
-
throw new Error(`Supplied userId: ${userId} doesn't exist`);
|
|
145
|
-
}
|
|
146
|
-
if (!(await recordExist(pool, "roles", { id: roleId }))) {
|
|
147
|
-
throw new Error(`Supplied roleId: ${roleId} doesn't exist`);
|
|
148
|
-
}
|
|
149
|
-
if (
|
|
150
|
-
!(await recordExist(pool, "user_roles", {
|
|
151
|
-
role_id: roleId,
|
|
152
|
-
user_id: userId
|
|
153
|
-
}))
|
|
154
|
-
) {
|
|
155
|
-
throw new Error(
|
|
156
|
-
`Cannot remove the role: User (id: ${userId}) has no Role with id: ${roleId}!`
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
await pool.query(
|
|
160
|
-
`DELETE FROM user_roles WHERE role_id = $1 AND user_id = $2`,
|
|
161
|
-
[roleId, userId]
|
|
162
|
-
);
|
|
163
|
-
console.log(chalk.green("Operation Completed!"));
|
|
164
|
-
} catch (e) {
|
|
165
|
-
console.error(chalk.red(`Error: ${e}`));
|
|
166
|
-
}
|
|
167
|
-
process.exit(0);
|
|
168
|
-
})
|
|
169
|
-
.parse(process.argv);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/***/ }),
|
|
173
|
-
|
|
174
|
-
/***/ 3:
|
|
175
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
176
|
-
|
|
177
|
-
const pg = __webpack_require__(4);
|
|
178
|
-
const getDBConfig = __webpack_require__(5);
|
|
179
|
-
|
|
180
|
-
const pool = new pg.Pool(getDBConfig());
|
|
181
|
-
pool.on("error", function (err, client) {
|
|
182
|
-
console.error("DB Pool Error: ", err.message, err.stack);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
function getDBPool() {
|
|
186
|
-
return pool;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
module.exports = getDBPool;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
/***/ }),
|
|
193
|
-
|
|
194
|
-
/***/ 4:
|
|
195
|
-
/***/ (function(module, exports) {
|
|
196
|
-
|
|
197
|
-
module.exports = require("pg");
|
|
198
|
-
|
|
199
|
-
/***/ }),
|
|
200
|
-
|
|
201
|
-
/***/ 5:
|
|
202
|
-
/***/ (function(module, exports) {
|
|
203
|
-
|
|
204
|
-
function getDBConfig() {
|
|
205
|
-
const {
|
|
206
|
-
POSTGRES_HOST: host,
|
|
207
|
-
POSTGRES_DB: database,
|
|
208
|
-
POSTGRES_USER: user,
|
|
209
|
-
POSTGRES_PASSWORD: password,
|
|
210
|
-
POSTGRES_PORT: port
|
|
211
|
-
} = process.env;
|
|
212
|
-
|
|
213
|
-
return {
|
|
214
|
-
host: host ? host : "localhost",
|
|
215
|
-
database: database ? database : "auth",
|
|
216
|
-
port: port ? port : 5432,
|
|
217
|
-
user: user ? user : "postgres",
|
|
218
|
-
password: password ? password : ""
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
module.exports = getDBConfig;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
/***/ }),
|
|
226
|
-
|
|
227
|
-
/***/ 6:
|
|
228
|
-
/***/ (function(module, exports) {
|
|
229
|
-
|
|
230
|
-
async function recordExist(pool, table, record) {
|
|
231
|
-
if (!Object.keys(record).length) {
|
|
232
|
-
throw new Error("record cannot be an empty object!");
|
|
233
|
-
}
|
|
234
|
-
const sqlValues = [];
|
|
235
|
-
const where = Object.keys(record)
|
|
236
|
-
.map((key) => {
|
|
237
|
-
sqlValues.push(record[key]);
|
|
238
|
-
return `"${key}" = $${sqlValues.length}`;
|
|
239
|
-
})
|
|
240
|
-
.join(" AND ");
|
|
241
|
-
const result = await pool.query(
|
|
242
|
-
`SELECT id FROM "${table}" WHERE ${where}`,
|
|
243
|
-
sqlValues
|
|
244
|
-
);
|
|
245
|
-
if (!result || !result.rows || !result.rows.length) {
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const ADMIN_ROLE_ID = "00000000-0000-0003-0000-000000000000";
|
|
252
|
-
|
|
253
|
-
module.exports.recordExist = recordExist;
|
|
254
|
-
module.exports.ADMIN_ROLE_ID = ADMIN_ROLE_ID;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
/***/ })
|
|
258
|
-
|
|
259
|
-
/******/ });
|
|
260
|
-
});
|
|
@@ -1,157 +0,0 @@
|
|
|
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 = 28);
|
|
96
|
-
/******/ })
|
|
97
|
-
/************************************************************************/
|
|
98
|
-
/******/ ({
|
|
99
|
-
|
|
100
|
-
/***/ 0:
|
|
101
|
-
/***/ (function(module, exports) {
|
|
102
|
-
|
|
103
|
-
module.exports = require("../../package.json");
|
|
104
|
-
|
|
105
|
-
/***/ }),
|
|
106
|
-
|
|
107
|
-
/***/ 1:
|
|
108
|
-
/***/ (function(module, exports) {
|
|
109
|
-
|
|
110
|
-
module.exports = require("commander");
|
|
111
|
-
|
|
112
|
-
/***/ }),
|
|
113
|
-
|
|
114
|
-
/***/ 2:
|
|
115
|
-
/***/ (function(module, exports) {
|
|
116
|
-
|
|
117
|
-
module.exports = require("chalk");
|
|
118
|
-
|
|
119
|
-
/***/ }),
|
|
120
|
-
|
|
121
|
-
/***/ 28:
|
|
122
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const pkg = __webpack_require__(0);
|
|
126
|
-
const program = __webpack_require__(1);
|
|
127
|
-
const chalk = __webpack_require__(2);
|
|
128
|
-
|
|
129
|
-
program
|
|
130
|
-
.version(pkg.version)
|
|
131
|
-
.description(
|
|
132
|
-
`A tool for removing magda access control role / permission assignment. Version: ${pkg.version}`
|
|
133
|
-
)
|
|
134
|
-
.command(
|
|
135
|
-
"permission <permissionId> <roleId>",
|
|
136
|
-
"Remove a permission from a role"
|
|
137
|
-
)
|
|
138
|
-
.command("role <roleId> <userId>", "Remove a role from a user")
|
|
139
|
-
.on("command:*", function (cmds) {
|
|
140
|
-
if (["permission", "role"].indexOf(cmds[0]) === -1) {
|
|
141
|
-
console.error(
|
|
142
|
-
chalk.red(
|
|
143
|
-
`Invalid command: ${program.args.join(
|
|
144
|
-
" "
|
|
145
|
-
)}\nSee --help for a list of available commands.`
|
|
146
|
-
)
|
|
147
|
-
);
|
|
148
|
-
process.exit(1);
|
|
149
|
-
}
|
|
150
|
-
})
|
|
151
|
-
.parse(process.argv);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
/***/ })
|
|
155
|
-
|
|
156
|
-
/******/ });
|
|
157
|
-
});
|
package/bin/acs-cmd/acs-cmd.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
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 = 8);
|
|
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
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const pkg = __webpack_require__(0);
|
|
127
|
-
const program = __webpack_require__(1);
|
|
128
|
-
const chalk = __webpack_require__(2);
|
|
129
|
-
|
|
130
|
-
program
|
|
131
|
-
.version(pkg.version)
|
|
132
|
-
.description(
|
|
133
|
-
`A tool for managing magda access control data. Version: ${pkg.version}\n\n` +
|
|
134
|
-
`If a database connection is required, the following environment variables will be used to create a connection:\n` +
|
|
135
|
-
` POSTGRES_HOST: database host; If not available in env var, 'localhost' will be used.\n` +
|
|
136
|
-
` POSTGRES_PORT: database port; If not available in env var, 5432 will be used.\n` +
|
|
137
|
-
` POSTGRES_DB: database name; If not available in env var, 'auth' will be used.\n` +
|
|
138
|
-
` POSTGRES_USER: database username; If not available in env var, 'postgres' will be used.\n` +
|
|
139
|
-
` POSTGRES_PASSWORD: database password; If not available in env var, '' will be used.`
|
|
140
|
-
)
|
|
141
|
-
.command(
|
|
142
|
-
"admin",
|
|
143
|
-
"Make an user an Admin user or remove admin role / status from a user"
|
|
144
|
-
)
|
|
145
|
-
.command("list", "List records (permissions, operations etc.)")
|
|
146
|
-
.command("assign", "Assign a permission to a role or a role to a user")
|
|
147
|
-
.command("remove", "Remove a permission from a role or a role from a user")
|
|
148
|
-
.command("create", "Create permissions, operations etc")
|
|
149
|
-
.command(
|
|
150
|
-
"jwt <userId> [jwtSecret]",
|
|
151
|
-
"calculate JWT token (only for testing purpose)"
|
|
152
|
-
)
|
|
153
|
-
.on("command:*", function (cmds) {
|
|
154
|
-
if (
|
|
155
|
-
["admin", "list", "assign", "remove", "jwt", "create"].indexOf(
|
|
156
|
-
cmds[0]
|
|
157
|
-
) === -1
|
|
158
|
-
) {
|
|
159
|
-
console.error(
|
|
160
|
-
chalk.red(
|
|
161
|
-
`Invalid command: ${program.args.join(
|
|
162
|
-
" "
|
|
163
|
-
)}\nSee --help for a list of available commands.`
|
|
164
|
-
)
|
|
165
|
-
);
|
|
166
|
-
process.exit(1);
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
.parse(process.argv);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/***/ })
|
|
173
|
-
/******/ ]);
|
|
174
|
-
});
|