@flink-app/generic-auth-plugin 0.11.19 → 0.12.1-alpha.1
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/.flink/generatedHandlers.ts +1 -1
- package/.flink/generatedJobs.ts +1 -1
- package/.flink/generatedRepos.ts +1 -1
- package/.flink/schemas/schemas.json +2 -4
- package/.flink/schemas/schemas.ts +1 -1
- package/.flink/start.ts +1 -1
- package/dist/.flink/generatedHandlers.js +1 -1
- package/dist/.flink/generatedJobs.js +1 -1
- package/dist/.flink/generatedRepos.js +1 -1
- package/dist/.flink/schemas/schemas.json +2 -4
- package/dist/.flink/start.js +1 -1
- package/dist/src/coreFunctions.js +14 -14
- package/dist/src/handlers/Management/DeleteUserByUserid.js +21 -23
- package/dist/src/handlers/Management/GetSchema.js +12 -14
- package/dist/src/handlers/Management/GetUser.js +21 -23
- package/dist/src/handlers/Management/GetUserByUserid.js +22 -24
- package/dist/src/handlers/Management/GetUserViewByUserid.js +34 -36
- package/dist/src/handlers/Management/PutUserPasswordByUserid.js +46 -48
- package/dist/src/handlers/Management/PutUserProfileByUserid.js +24 -26
- package/dist/src/handlers/Management/PutUserProfileByUseridAppend.js +27 -29
- package/dist/src/handlers/Management/PutUserRolesByUserid.js +24 -26
- package/dist/src/handlers/Management/PutUserUsernameByUserid.js +33 -35
- package/dist/src/handlers/UserCreate.js +44 -46
- package/dist/src/handlers/UserLogin.js +23 -25
- package/dist/src/handlers/UserLoginByToken.js +23 -25
- package/dist/src/handlers/UserPasswordPut.js +21 -23
- package/dist/src/handlers/UserPasswordResetComplete.js +27 -29
- package/dist/src/handlers/UserPasswordResetForm.js +11 -11
- package/dist/src/handlers/UserPasswordResetStart.js +53 -55
- package/dist/src/handlers/UserProfileGet.js +21 -23
- package/dist/src/handlers/UserProfilePut.js +28 -30
- package/dist/src/handlers/UserPushRegisterToken.js +72 -74
- package/dist/src/handlers/UserPushRemoveToken.js +25 -27
- package/dist/src/handlers/UserToken.js +24 -26
- package/dist/src/index.js +7 -8
- package/dist/src/init.js +8 -4
- package/dist/src/management.js +5 -1
- package/dist/src/schemas/User.d.ts +1 -1
- package/dist/src/schemas/User.js +0 -1
- package/package.json +32 -32
- package/src/coreFunctions.ts +34 -59
- package/src/schemas/User.ts +8 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated Wed Mar
|
|
1
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
|
|
3
3
|
import * as UserCreate_0 from "../src/handlers/UserCreate";
|
|
4
4
|
import * as UserLogin_0 from "../src/handlers/UserLogin";
|
package/.flink/generatedJobs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated Wed Mar
|
|
1
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredJobs } from "@flink-app/flink";
|
|
3
3
|
export const jobs = [];
|
|
4
4
|
autoRegisteredJobs.push(...jobs);
|
package/.flink/generatedRepos.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated Wed Mar
|
|
1
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredRepos } from "@flink-app/flink";
|
|
3
3
|
export const repos = [];
|
|
4
4
|
autoRegisteredRepos.push(...repos);
|
|
@@ -357,8 +357,7 @@
|
|
|
357
357
|
"enum": [
|
|
358
358
|
"firebase",
|
|
359
359
|
"apn-voip"
|
|
360
|
-
]
|
|
361
|
-
"description": "The type of the token. This is used to determine which push notification service to use. Default is \"firebase\""
|
|
360
|
+
]
|
|
362
361
|
}
|
|
363
362
|
},
|
|
364
363
|
"required": [
|
|
@@ -409,8 +408,7 @@
|
|
|
409
408
|
"enum": [
|
|
410
409
|
"firebase",
|
|
411
410
|
"apn-voip"
|
|
412
|
-
]
|
|
413
|
-
"description": "The type of the token. This is used to determine which push notification service to use. Default is \"firebase\""
|
|
411
|
+
]
|
|
414
412
|
}
|
|
415
413
|
},
|
|
416
414
|
"required": [
|
|
@@ -29,7 +29,7 @@ import { PutManagementUserRolesByUseridRes } from "../../src/schemas/Management/
|
|
|
29
29
|
import { PutManagementUserUsernameByUseridReq } from "../../src/schemas/Management/PutUserUsernameByUseridReq";
|
|
30
30
|
import { PutManagementUserUsernameByUseridRes } from "../../src/schemas/Management/PutUserUsernameByUseridRes";
|
|
31
31
|
|
|
32
|
-
// Generated Wed Mar
|
|
32
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
33
33
|
export interface UserCreate_7_ReqSchema extends UserCreateReq {}
|
|
34
34
|
|
|
35
35
|
export interface UserCreate_7_ResSchema extends UserCreateRes {}
|
package/.flink/start.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handlers = void 0;
|
|
4
|
-
// Generated Wed Mar
|
|
4
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.handlers = [];
|
|
7
7
|
flink_1.autoRegisteredHandlers.push.apply(flink_1.autoRegisteredHandlers, exports.handlers);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jobs = void 0;
|
|
4
|
-
// Generated Wed Mar
|
|
4
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.jobs = [];
|
|
7
7
|
flink_1.autoRegisteredJobs.push.apply(flink_1.autoRegisteredJobs, exports.jobs);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.repos = void 0;
|
|
4
|
-
// Generated Wed Mar
|
|
4
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.repos = [];
|
|
7
7
|
flink_1.autoRegisteredRepos.push.apply(flink_1.autoRegisteredRepos, exports.repos);
|
|
@@ -357,8 +357,7 @@
|
|
|
357
357
|
"enum": [
|
|
358
358
|
"firebase",
|
|
359
359
|
"apn-voip"
|
|
360
|
-
]
|
|
361
|
-
"description": "The type of the token. This is used to determine which push notification service to use. Default is \"firebase\""
|
|
360
|
+
]
|
|
362
361
|
}
|
|
363
362
|
},
|
|
364
363
|
"required": [
|
|
@@ -409,8 +408,7 @@
|
|
|
409
408
|
"enum": [
|
|
410
409
|
"firebase",
|
|
411
410
|
"apn-voip"
|
|
412
|
-
]
|
|
413
|
-
"description": "The type of the token. This is used to determine which push notification service to use. Default is \"firebase\""
|
|
411
|
+
]
|
|
414
412
|
}
|
|
415
413
|
},
|
|
416
414
|
"required": [
|
package/dist/.flink/start.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Generated Wed Mar
|
|
3
|
+
// Generated Wed Mar 19 2025 22:58:44 GMT+0100 (Central European Standard Time)
|
|
4
4
|
require("./generatedHandlers");
|
|
5
5
|
require("./generatedRepos");
|
|
6
6
|
require("./generatedJobs");
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -54,7 +54,7 @@ function getJtwTokenPlugin(secret, rolePermissions, passwordPolicy, tokenTTL) {
|
|
|
54
54
|
}
|
|
55
55
|
if (!rolePermissions["user"].includes("authenticated"))
|
|
56
56
|
rolePermissions["user"].push("authenticated");
|
|
57
|
-
return jwt_auth_plugin_1.jwtAuthPlugin({
|
|
57
|
+
return (0, jwt_auth_plugin_1.jwtAuthPlugin)({
|
|
58
58
|
secret: secret,
|
|
59
59
|
getUser: function (tokenData) {
|
|
60
60
|
return new Promise(function (res) {
|
|
@@ -66,7 +66,7 @@ function getJtwTokenPlugin(secret, rolePermissions, passwordPolicy, tokenTTL) {
|
|
|
66
66
|
},
|
|
67
67
|
passwordPolicy: passwordPolicy,
|
|
68
68
|
rolePermissions: rolePermissions,
|
|
69
|
-
tokenTTL: tokenTTL
|
|
69
|
+
tokenTTL: tokenTTL,
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
exports.getJtwTokenPlugin = getJtwTokenPlugin;
|
|
@@ -223,7 +223,7 @@ function loginUser(repo, auth, username, password, validatePasswordMethod, smsOp
|
|
|
223
223
|
smsOptions.smsClient.send({
|
|
224
224
|
to: [user.username],
|
|
225
225
|
from: smsOptions.smsFrom,
|
|
226
|
-
message: smsOptions.smsMessage.replace("{{code}}", code)
|
|
226
|
+
message: smsOptions.smsMessage.replace("{{code}}", code),
|
|
227
227
|
});
|
|
228
228
|
payload = {
|
|
229
229
|
type: "smsLogin",
|
|
@@ -236,7 +236,7 @@ function loginUser(repo, auth, username, password, validatePasswordMethod, smsOp
|
|
|
236
236
|
token = jsonwebtoken_1.default.sign(payload, secret, options);
|
|
237
237
|
return [2 /*return*/, {
|
|
238
238
|
status: "success",
|
|
239
|
-
validationToken: token
|
|
239
|
+
validationToken: token,
|
|
240
240
|
}];
|
|
241
241
|
}
|
|
242
242
|
if (!valid) return [3 /*break*/, 13];
|
|
@@ -305,10 +305,10 @@ function changePassword(repo, auth, userId, newPassword, createPasswordHashAndSa
|
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
exports.changePassword = changePassword;
|
|
308
|
-
function passwordResetStart(
|
|
309
|
-
|
|
310
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
308
|
+
function passwordResetStart(repo_1, auth_1, jwtSecret_1, username_1, numberOfDigits_1, lifeTime_1) {
|
|
309
|
+
return __awaiter(this, arguments, void 0, function (repo, auth, jwtSecret, username, numberOfDigits, lifeTime, passwordResetReusableTokens) {
|
|
311
310
|
var user, fakepayload, fakeToken, payload, code, pwdResetStartedAt, secret, options, token;
|
|
311
|
+
if (passwordResetReusableTokens === void 0) { passwordResetReusableTokens = true; }
|
|
312
312
|
return __generator(this, function (_a) {
|
|
313
313
|
switch (_a.label) {
|
|
314
314
|
case 0: return [4 /*yield*/, repo.getOne({ username: username.toLowerCase() })];
|
|
@@ -360,10 +360,10 @@ function passwordResetStart(repo, auth, jwtSecret, username, numberOfDigits, lif
|
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
exports.passwordResetStart = passwordResetStart;
|
|
363
|
-
function passwordResetComplete(
|
|
364
|
-
|
|
365
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
363
|
+
function passwordResetComplete(repo_1, auth_1, jwtSecret_1, passwordResetToken_1, code_1, newPassword_1, createPasswordHashAndSaltMethod_1) {
|
|
364
|
+
return __awaiter(this, arguments, void 0, function (repo, auth, jwtSecret, passwordResetToken, code, newPassword, createPasswordHashAndSaltMethod, passwordResetReusableTokens) {
|
|
366
365
|
var payload, user, secret, passwordAndSalt;
|
|
366
|
+
if (passwordResetReusableTokens === void 0) { passwordResetReusableTokens = true; }
|
|
367
367
|
return __generator(this, function (_a) {
|
|
368
368
|
switch (_a.label) {
|
|
369
369
|
case 0:
|
|
@@ -410,7 +410,7 @@ function passwordResetComplete(repo, auth, jwtSecret, passwordResetToken, code,
|
|
|
410
410
|
return [4 /*yield*/, repo.updateOne(user._id, {
|
|
411
411
|
password: passwordAndSalt.hash,
|
|
412
412
|
salt: passwordAndSalt.salt,
|
|
413
|
-
pwdResetStartedAt: null
|
|
413
|
+
pwdResetStartedAt: null,
|
|
414
414
|
})];
|
|
415
415
|
case 6:
|
|
416
416
|
_a.sent();
|
|
@@ -431,8 +431,8 @@ function generate(n) {
|
|
|
431
431
|
return ("" + number).substring(add);
|
|
432
432
|
}
|
|
433
433
|
function generateString(length) {
|
|
434
|
-
var characters =
|
|
435
|
-
var result =
|
|
434
|
+
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
435
|
+
var result = " ";
|
|
436
436
|
var charactersLength = characters.length;
|
|
437
437
|
for (var i = 0; i < length; i++) {
|
|
438
438
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -38,29 +38,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
40
|
var flink_1 = require("@flink-app/flink");
|
|
41
|
-
var DeleteManagementUserByUserid = function (_a) {
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
});
|
|
41
|
+
var DeleteManagementUserByUserid = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
42
|
+
var pluginName, repo, count;
|
|
43
|
+
var ctx = _b.ctx, req = _b.req, origin = _b.origin;
|
|
44
|
+
return __generator(this, function (_c) {
|
|
45
|
+
switch (_c.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
pluginName = origin || "genericAuthPlugin";
|
|
48
|
+
repo = ctx.repos[ctx.plugins[pluginName].repoName];
|
|
49
|
+
return [4 /*yield*/, repo.deleteById(req.params.userid)];
|
|
50
|
+
case 1:
|
|
51
|
+
count = _c.sent();
|
|
52
|
+
if (count == null) {
|
|
53
|
+
return [2 /*return*/, (0, flink_1.notFound)()];
|
|
54
|
+
}
|
|
55
|
+
return [2 /*return*/, {
|
|
56
|
+
data: {},
|
|
57
|
+
status: 200
|
|
58
|
+
}];
|
|
59
|
+
}
|
|
62
60
|
});
|
|
63
|
-
};
|
|
61
|
+
}); };
|
|
64
62
|
exports.default = DeleteManagementUserByUserid;
|
|
65
63
|
exports.__assumedHttpMethod = "delete", exports.__file = "DeleteUserByUserid.ts", exports.__query = [], exports.__params = [];
|
|
66
64
|
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} } };
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -37,20 +37,18 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
|
-
var GetSchema = function (_a) {
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}];
|
|
51
|
-
});
|
|
40
|
+
var GetSchema = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
41
|
+
var modules, module;
|
|
42
|
+
var ctx = _b.ctx, req = _b.req, origin = _b.origin;
|
|
43
|
+
return __generator(this, function (_c) {
|
|
44
|
+
modules = ctx.plugins.managementApi.moduleList.modules;
|
|
45
|
+
module = modules.find(function (p) { return p.id == origin; });
|
|
46
|
+
return [2 /*return*/, {
|
|
47
|
+
data: module === null || module === void 0 ? void 0 : module.data.profileSchema,
|
|
48
|
+
status: 200,
|
|
49
|
+
}];
|
|
52
50
|
});
|
|
53
|
-
};
|
|
51
|
+
}); };
|
|
54
52
|
exports.default = GetSchema;
|
|
55
53
|
exports.__assumedHttpMethod = "get", exports.__file = "GetSchema.ts", exports.__query = [], exports.__params = [];
|
|
56
54
|
exports.__schemas = { reqSchema: undefined, resSchema: undefined };
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -37,29 +37,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
|
-
var GetManagementUser = function (_a) {
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
});
|
|
40
|
+
var GetManagementUser = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
41
|
+
var pluginName, repo, users;
|
|
42
|
+
var ctx = _b.ctx, req = _b.req, origin = _b.origin;
|
|
43
|
+
return __generator(this, function (_c) {
|
|
44
|
+
switch (_c.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
pluginName = origin || "genericAuthPlugin";
|
|
47
|
+
repo = ctx.repos[ctx.plugins[pluginName].repoName];
|
|
48
|
+
return [4 /*yield*/, repo.findAll({})];
|
|
49
|
+
case 1:
|
|
50
|
+
users = _c.sent();
|
|
51
|
+
users = users.map(function (u) {
|
|
52
|
+
return { username: u.username, _id: u._id };
|
|
53
|
+
});
|
|
54
|
+
return [2 /*return*/, {
|
|
55
|
+
data: { users: users },
|
|
56
|
+
status: 200,
|
|
57
|
+
}];
|
|
58
|
+
}
|
|
61
59
|
});
|
|
62
|
-
};
|
|
60
|
+
}); };
|
|
63
61
|
exports.default = GetManagementUser;
|
|
64
62
|
exports.__assumedHttpMethod = "get", exports.__file = "GetUser.ts", exports.__query = [], exports.__params = [];
|
|
65
63
|
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "users": { "type": "array", "items": { "type": "object", "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"], "additionalProperties": false } } }, "required": ["users"], "definitions": {} } };
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -49,30 +49,28 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
51
51
|
var flink_1 = require("@flink-app/flink");
|
|
52
|
-
var GetManagementUserByUserid = function (_a) {
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
});
|
|
52
|
+
var GetManagementUserByUserid = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
53
|
+
var pluginName, repo, user, password, salt, u;
|
|
54
|
+
var ctx = _b.ctx, req = _b.req, origin = _b.origin;
|
|
55
|
+
return __generator(this, function (_c) {
|
|
56
|
+
switch (_c.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
pluginName = origin || "genericAuthPlugin";
|
|
59
|
+
repo = ctx.repos[ctx.plugins[pluginName].repoName];
|
|
60
|
+
return [4 /*yield*/, repo.getById(req.params.userid)];
|
|
61
|
+
case 1:
|
|
62
|
+
user = _c.sent();
|
|
63
|
+
if (user == null) {
|
|
64
|
+
return [2 /*return*/, (0, flink_1.notFound)()];
|
|
65
|
+
}
|
|
66
|
+
password = user.password, salt = user.salt, u = __rest(user, ["password", "salt"]);
|
|
67
|
+
return [2 /*return*/, {
|
|
68
|
+
data: u,
|
|
69
|
+
status: 200,
|
|
70
|
+
}];
|
|
71
|
+
}
|
|
74
72
|
});
|
|
75
|
-
};
|
|
73
|
+
}); };
|
|
76
74
|
exports.default = GetManagementUserByUserid;
|
|
77
75
|
exports.__assumedHttpMethod = "get", exports.__file = "GetUserByUserid.ts", exports.__query = [], exports.__params = [];
|
|
78
76
|
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} }, resSchema: undefined };
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -38,43 +38,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
40
|
var flink_1 = require("@flink-app/flink");
|
|
41
|
-
var GetManagementUserByUserid = function (_a) {
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
username: user.username,
|
|
61
|
-
};
|
|
62
|
-
return {
|
|
63
|
-
buttons: [],
|
|
64
|
-
data: data,
|
|
65
|
-
};
|
|
41
|
+
var GetManagementUserByUserid = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
42
|
+
var pluginName, repo, user, modules, module, getData;
|
|
43
|
+
var ctx = _b.ctx, req = _b.req, origin = _b.origin;
|
|
44
|
+
return __generator(this, function (_c) {
|
|
45
|
+
switch (_c.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
pluginName = origin || "genericAuthPlugin";
|
|
48
|
+
repo = ctx.repos[ctx.plugins[pluginName].repoName];
|
|
49
|
+
return [4 /*yield*/, repo.getById(req.params.userid)];
|
|
50
|
+
case 1:
|
|
51
|
+
user = _c.sent();
|
|
52
|
+
if (user == null) {
|
|
53
|
+
return [2 /*return*/, (0, flink_1.notFound)()];
|
|
54
|
+
}
|
|
55
|
+
modules = ctx.plugins.managementApi.moduleList.modules;
|
|
56
|
+
module = modules.find(function (p) { return p.id == origin; });
|
|
57
|
+
getData = function (user) {
|
|
58
|
+
var data = {
|
|
59
|
+
username: user.username,
|
|
66
60
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
return {
|
|
62
|
+
buttons: [],
|
|
63
|
+
data: data,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
if ((module === null || module === void 0 ? void 0 : module.data.userViewGetData) != null) {
|
|
67
|
+
getData = module === null || module === void 0 ? void 0 : module.data.userViewGetData;
|
|
68
|
+
}
|
|
69
|
+
return [2 /*return*/, {
|
|
70
|
+
data: getData(user),
|
|
71
|
+
status: 200,
|
|
72
|
+
}];
|
|
73
|
+
}
|
|
76
74
|
});
|
|
77
|
-
};
|
|
75
|
+
}); };
|
|
78
76
|
exports.default = GetManagementUserByUserid;
|
|
79
77
|
exports.__assumedHttpMethod = "get", exports.__file = "GetUserViewByUserid.ts", exports.__query = [], exports.__params = [];
|
|
80
78
|
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "buttons": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string" }, "url": { "type": "string" } }, "required": ["text", "url"], "additionalProperties": false } }, "data": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["buttons", "data"], "definitions": {} } };
|