@flink-app/generic-auth-plugin 0.3.0 → 0.3.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.
@@ -1,4 +1,4 @@
1
- // Generated Fri Nov 19 2021 11:09:05 GMT+0100 (Central European Standard Time)
1
+ // Generated Wed Mar 02 2022 14:42:35 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";
@@ -15,6 +15,7 @@ import * as DeleteUserByUserid_0 from "../src/handlers/Management/DeleteUserByUs
15
15
  import * as GetSchema_0 from "../src/handlers/Management/GetSchema";
16
16
  import * as GetUser_0 from "../src/handlers/Management/GetUser";
17
17
  import * as GetUserByUserid_0 from "../src/handlers/Management/GetUserByUserid";
18
+ import * as GetUserViewByUserid_0 from "../src/handlers/Management/GetUserViewByUserid";
18
19
  import * as PutUserPasswordByUserid_0 from "../src/handlers/Management/PutUserPasswordByUserid";
19
20
  import * as PutUserProfileByUserid_0 from "../src/handlers/Management/PutUserProfileByUserid";
20
21
  import * as PutUserProfileByUseridAppend_0 from "../src/handlers/Management/PutUserProfileByUseridAppend";
@@ -1,4 +1,4 @@
1
- // Generated Fri Nov 19 2021 11:09:05 GMT+0100 (Central European Standard Time)
1
+ // Generated Wed Mar 02 2022 14:42:35 GMT+0100 (Central European Standard Time)
2
2
  import { autoRegisteredRepos } from "@flink-app/flink";
3
3
  export const repos = [];
4
4
  autoRegisteredRepos.push(...repos);
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$ref": "#/definitions/Schemas",
4
4
  "definitions": {
5
- "UserCreate_13_ReqSchema": {
5
+ "UserCreate_7_ReqSchema": {
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "properties": {
@@ -30,7 +30,7 @@
30
30
  "UserProfile": {
31
31
  "type": "object"
32
32
  },
33
- "UserCreate_13_ResSchema": {
33
+ "UserCreate_7_ResSchema": {
34
34
  "type": "object",
35
35
  "additionalProperties": false,
36
36
  "properties": {
@@ -425,6 +425,46 @@
425
425
  ],
426
426
  "additionalProperties": false
427
427
  },
428
+ "GetUserViewByUserid_6_ReqSchema": {
429
+ "type": "object",
430
+ "additionalProperties": false,
431
+ "properties": {}
432
+ },
433
+ "GetUserViewByUserid_6_ResSchema": {
434
+ "type": "object",
435
+ "additionalProperties": false,
436
+ "properties": {
437
+ "buttons": {
438
+ "type": "array",
439
+ "items": {
440
+ "type": "object",
441
+ "properties": {
442
+ "text": {
443
+ "type": "string"
444
+ },
445
+ "url": {
446
+ "type": "string"
447
+ }
448
+ },
449
+ "required": [
450
+ "text",
451
+ "url"
452
+ ],
453
+ "additionalProperties": false
454
+ }
455
+ },
456
+ "data": {
457
+ "type": "object",
458
+ "additionalProperties": {
459
+ "type": "string"
460
+ }
461
+ }
462
+ },
463
+ "required": [
464
+ "buttons",
465
+ "data"
466
+ ]
467
+ },
428
468
  "PutUserPasswordByUserid_6_ReqSchema": {
429
469
  "type": "object",
430
470
  "additionalProperties": false,
@@ -18,6 +18,8 @@ import { GetManagementUserReq } from "../../src/schemas/Management/GetUserReq";
18
18
  import { GetManagementUserRes } from "../../src/schemas/Management/GetUserRes";
19
19
  import { GetManagementUserByUseridReq } from "../../src/schemas/Management/GetUserByUseridReq";
20
20
  import { GetManagementUserByUseridRes } from "../../src/schemas/Management/GetUserByUseridRes";
21
+ import { GetManagementUserViewByUseridReq } from "../../src/schemas/Management/GetUserViewByUseridReq";
22
+ import { GetManagementUserViewByUseridRes } from "../../src/schemas/Management/GetUserViewByUseridRes";
21
23
  import { PutManagementUserPasswordByUseridReq } from "../../src/schemas/Management/PutUserPasswordByUseridReq";
22
24
  import { PutManagementUserPasswordByUseridRes } from "../../src/schemas/Management/PutUserPasswordByUseridRes";
23
25
  import { PutManagementUserProfileByUseridReq } from "../../src/schemas/Management/PutUserProfileByUseridReq";
@@ -27,10 +29,10 @@ import { PutManagementUserRolesByUseridRes } from "../../src/schemas/Management/
27
29
  import { PutManagementUserUsernameByUseridReq } from "../../src/schemas/Management/PutUserUsernameByUseridReq";
28
30
  import { PutManagementUserUsernameByUseridRes } from "../../src/schemas/Management/PutUserUsernameByUseridRes";
29
31
 
30
- // Generated Fri Nov 19 2021 11:09:07 GMT+0100 (Central European Standard Time)
31
- export interface UserCreate_13_ReqSchema extends UserCreateReq {}
32
+ // Generated Wed Mar 02 2022 14:42:37 GMT+0100 (Central European Standard Time)
33
+ export interface UserCreate_7_ReqSchema extends UserCreateReq {}
32
34
 
33
- export interface UserCreate_13_ResSchema extends UserCreateRes {}
35
+ export interface UserCreate_7_ResSchema extends UserCreateRes {}
34
36
 
35
37
  export interface UserLogin_7_ReqSchema extends UserLoginReq {}
36
38
 
@@ -76,6 +78,10 @@ export interface GetUserByUserid_11_ReqSchema extends GetManagementUserByUseridR
76
78
 
77
79
  export interface GetUserByUserid_11_ResSchema extends GetManagementUserByUseridRes {}
78
80
 
81
+ export interface GetUserViewByUserid_6_ReqSchema extends GetManagementUserViewByUseridReq {}
82
+
83
+ export interface GetUserViewByUserid_6_ResSchema extends GetManagementUserViewByUseridRes {}
84
+
79
85
  export interface PutUserPasswordByUserid_6_ReqSchema extends PutManagementUserPasswordByUseridReq {}
80
86
 
81
87
  export interface PutUserPasswordByUserid_6_ResSchema extends PutManagementUserPasswordByUseridRes {}
package/.flink/start.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Generated Fri Nov 19 2021 11:09:06 GMT+0100 (Central European Standard Time)
1
+ // Generated Wed Mar 02 2022 14:42:35 GMT+0100 (Central European Standard Time)
2
2
  import "./generatedHandlers";
3
3
  import "./generatedRepos";
4
4
  import "../src/index";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handlers = void 0;
4
- // Generated Fri Nov 19 2021 11:09:05 GMT+0100 (Central European Standard Time)
4
+ // Generated Wed Mar 02 2022 14:42:35 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.repos = void 0;
4
- // Generated Fri Nov 19 2021 11:09:05 GMT+0100 (Central European Standard Time)
4
+ // Generated Wed Mar 02 2022 14:42:35 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);
@@ -18,6 +18,8 @@ import { GetManagementUserReq } from "../../src/schemas/Management/GetUserReq";
18
18
  import { GetManagementUserRes } from "../../src/schemas/Management/GetUserRes";
19
19
  import { GetManagementUserByUseridReq } from "../../src/schemas/Management/GetUserByUseridReq";
20
20
  import { GetManagementUserByUseridRes } from "../../src/schemas/Management/GetUserByUseridRes";
21
+ import { GetManagementUserViewByUseridReq } from "../../src/schemas/Management/GetUserViewByUseridReq";
22
+ import { GetManagementUserViewByUseridRes } from "../../src/schemas/Management/GetUserViewByUseridRes";
21
23
  import { PutManagementUserPasswordByUseridReq } from "../../src/schemas/Management/PutUserPasswordByUseridReq";
22
24
  import { PutManagementUserPasswordByUseridRes } from "../../src/schemas/Management/PutUserPasswordByUseridRes";
23
25
  import { PutManagementUserProfileByUseridReq } from "../../src/schemas/Management/PutUserProfileByUseridReq";
@@ -26,9 +28,9 @@ import { PutManagementUserRolesByUseridReq } from "../../src/schemas/Management/
26
28
  import { PutManagementUserRolesByUseridRes } from "../../src/schemas/Management/PutUserRolesByUseridRes";
27
29
  import { PutManagementUserUsernameByUseridReq } from "../../src/schemas/Management/PutUserUsernameByUseridReq";
28
30
  import { PutManagementUserUsernameByUseridRes } from "../../src/schemas/Management/PutUserUsernameByUseridRes";
29
- export interface UserCreate_13_ReqSchema extends UserCreateReq {
31
+ export interface UserCreate_7_ReqSchema extends UserCreateReq {
30
32
  }
31
- export interface UserCreate_13_ResSchema extends UserCreateRes {
33
+ export interface UserCreate_7_ResSchema extends UserCreateRes {
32
34
  }
33
35
  export interface UserLogin_7_ReqSchema extends UserLoginReq {
34
36
  }
@@ -74,6 +76,10 @@ export interface GetUserByUserid_11_ReqSchema extends GetManagementUserByUseridR
74
76
  }
75
77
  export interface GetUserByUserid_11_ResSchema extends GetManagementUserByUseridRes {
76
78
  }
79
+ export interface GetUserViewByUserid_6_ReqSchema extends GetManagementUserViewByUseridReq {
80
+ }
81
+ export interface GetUserViewByUserid_6_ResSchema extends GetManagementUserViewByUseridRes {
82
+ }
77
83
  export interface PutUserPasswordByUserid_6_ReqSchema extends PutManagementUserPasswordByUseridReq {
78
84
  }
79
85
  export interface PutUserPasswordByUserid_6_ResSchema extends PutManagementUserPasswordByUseridRes {
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$ref": "#/definitions/Schemas",
4
4
  "definitions": {
5
- "UserCreate_13_ReqSchema": {
5
+ "UserCreate_7_ReqSchema": {
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "properties": {
@@ -30,7 +30,7 @@
30
30
  "UserProfile": {
31
31
  "type": "object"
32
32
  },
33
- "UserCreate_13_ResSchema": {
33
+ "UserCreate_7_ResSchema": {
34
34
  "type": "object",
35
35
  "additionalProperties": false,
36
36
  "properties": {
@@ -425,6 +425,46 @@
425
425
  ],
426
426
  "additionalProperties": false
427
427
  },
428
+ "GetUserViewByUserid_6_ReqSchema": {
429
+ "type": "object",
430
+ "additionalProperties": false,
431
+ "properties": {}
432
+ },
433
+ "GetUserViewByUserid_6_ResSchema": {
434
+ "type": "object",
435
+ "additionalProperties": false,
436
+ "properties": {
437
+ "buttons": {
438
+ "type": "array",
439
+ "items": {
440
+ "type": "object",
441
+ "properties": {
442
+ "text": {
443
+ "type": "string"
444
+ },
445
+ "url": {
446
+ "type": "string"
447
+ }
448
+ },
449
+ "required": [
450
+ "text",
451
+ "url"
452
+ ],
453
+ "additionalProperties": false
454
+ }
455
+ },
456
+ "data": {
457
+ "type": "object",
458
+ "additionalProperties": {
459
+ "type": "string"
460
+ }
461
+ }
462
+ },
463
+ "required": [
464
+ "buttons",
465
+ "data"
466
+ ]
467
+ },
428
468
  "PutUserPasswordByUserid_6_ReqSchema": {
429
469
  "type": "object",
430
470
  "additionalProperties": false,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // Generated Fri Nov 19 2021 11:09:06 GMT+0100 (Central European Standard Time)
3
+ // Generated Wed Mar 02 2022 14:42:35 GMT+0100 (Central European Standard Time)
4
4
  require("./generatedHandlers");
5
5
  require("./generatedRepos");
6
6
  require("../src/index");
@@ -87,7 +87,7 @@ function createUser(repo, auth, username, password, authentificationMethod, role
87
87
  }];
88
88
  }
89
89
  userData = {
90
- username: username,
90
+ username: username.toLowerCase(),
91
91
  roles: roles,
92
92
  profile: profile,
93
93
  authentificationMethod: authentificationMethod,
@@ -281,7 +281,7 @@ function passwordResetComplete(repo, auth, jwtSecret, passwordResetToken, code,
281
281
  payload = { type: "", username: "" };
282
282
  try {
283
283
  secret = jwtSecret + ":" + code;
284
- payload = (jsonwebtoken_1.default.verify(passwordResetToken, secret));
284
+ payload = jsonwebtoken_1.default.verify(passwordResetToken, secret);
285
285
  }
286
286
  catch (ex) {
287
287
  return [2 /*return*/, { status: "invalidCode" }];
@@ -0,0 +1,7 @@
1
+ import { FlinkContext, Handler } from "@flink-app/flink";
2
+ import { GetManagementUserViewByUseridReq } from "../../schemas/Management/GetUserViewByUseridReq";
3
+ import { GetManagementUserViewByUseridRes } from "../../schemas/Management/GetUserViewByUseridRes";
4
+ declare const GetManagementUserByUserid: Handler<FlinkContext, GetManagementUserViewByUseridReq, GetManagementUserViewByUseridRes>;
5
+ export default GetManagementUserByUserid;
6
+ export declare const __assumedHttpMethod = "get", __file = "GetUserViewByUserid.ts", __query: never[], __params: never[];
7
+ export declare const __schemas: any;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
40
+ var flink_1 = require("@flink-app/flink");
41
+ var GetManagementUserByUserid = function (_a) {
42
+ var ctx = _a.ctx, req = _a.req, origin = _a.origin;
43
+ return __awaiter(void 0, void 0, void 0, function () {
44
+ var pluginName, repo, user, modules, module, getData;
45
+ return __generator(this, function (_b) {
46
+ switch (_b.label) {
47
+ case 0:
48
+ pluginName = origin || "genericAuthPlugin";
49
+ repo = ctx.repos[ctx.plugins[pluginName].repoName];
50
+ return [4 /*yield*/, repo.getById(req.params.userid)];
51
+ case 1:
52
+ user = _b.sent();
53
+ if (user == null) {
54
+ return [2 /*return*/, flink_1.notFound()];
55
+ }
56
+ modules = ctx.plugins.managementApi.moduleList.modules;
57
+ module = modules.find(function (p) { return p.id == origin; });
58
+ getData = function (user) {
59
+ var data = {
60
+ username: user.username,
61
+ };
62
+ return {
63
+ buttons: [],
64
+ data: data,
65
+ };
66
+ };
67
+ if ((module === null || module === void 0 ? void 0 : module.data.userViewGetData) != null) {
68
+ getData = module === null || module === void 0 ? void 0 : module.data.userViewGetData;
69
+ }
70
+ return [2 /*return*/, {
71
+ data: getData(user),
72
+ status: 200,
73
+ }];
74
+ }
75
+ });
76
+ });
77
+ };
78
+ exports.default = GetManagementUserByUserid;
79
+ exports.__assumedHttpMethod = "get", exports.__file = "GetUserViewByUserid.ts", exports.__query = [], exports.__params = [];
80
+ exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": {} }, resSchema: { "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"] } };
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -41,7 +52,7 @@ var flink_1 = require("@flink-app/flink");
41
52
  var putUserProfileHandler = function (_a) {
42
53
  var ctx = _a.ctx, req = _a.req, origin = _a.origin;
43
54
  return __awaiter(void 0, void 0, void 0, function () {
44
- var pluginName, repo, userId, user;
55
+ var pluginName, repo, userId, user, updatedProfile;
45
56
  return __generator(this, function (_b) {
46
57
  switch (_b.label) {
47
58
  case 0:
@@ -54,8 +65,8 @@ var putUserProfileHandler = function (_a) {
54
65
  if (user == null) {
55
66
  return [2 /*return*/, flink_1.notFound()];
56
67
  }
57
- user.profile = req.body;
58
- return [4 /*yield*/, repo.updateOne(userId, { profile: req.body })];
68
+ updatedProfile = __assign(__assign({}, user.profile), req.body);
69
+ return [4 /*yield*/, repo.updateOne(userId, { profile: updatedProfile })];
59
70
  case 2:
60
71
  _b.sent();
61
72
  return [4 /*yield*/, repo.getById(userId)];
@@ -1,13 +1,19 @@
1
1
  import { ManagementApiModule } from "@flink-app/management-api-plugin";
2
+ import { User } from ".";
3
+ import { GetManagementUserViewByUseridRes } from "./schemas/Management/GetUserViewByUseridRes";
2
4
  export interface GetManagementModuleConfig {
3
5
  pluginId?: string;
4
6
  profileSchema?: any;
5
7
  ui: boolean;
8
+ userView?: {
9
+ getData(user: User): GetManagementUserViewByUseridRes;
10
+ };
6
11
  uiSettings?: {
7
12
  title: string;
8
13
  enableUserDelete?: boolean;
9
14
  enableUserCreate?: boolean;
10
15
  enableUserEdit?: boolean;
16
+ enableUserView?: boolean;
11
17
  };
12
18
  }
13
19
  export declare const GetManagementModule: (config: GetManagementModuleConfig) => ManagementApiModule;
@@ -30,10 +30,11 @@ var PutManagementUserProfileByUserid = __importStar(require("./handlers/Manageme
30
30
  var PutManagementUserUsernameByUserid = __importStar(require("./handlers/Management/PutUserUsernameByUserid"));
31
31
  var PutManagementUserRolesByUserid = __importStar(require("./handlers/Management/PutUserRolesByUserid"));
32
32
  var DeleteManagementUserByUserid = __importStar(require("./handlers/Management/DeleteUserByUserid"));
33
+ var GetUserViewByUserid = __importStar(require("./handlers/Management/GetUserViewByUserid"));
33
34
  var PutUserProfileByUseridAppend = __importStar(require("./handlers/Management/PutUserProfileByUseridAppend"));
34
35
  var GetSchema = __importStar(require("./handlers/Management/GetSchema"));
35
36
  var GetManagementModule = function (config) {
36
- var _a, _b, _c, _d;
37
+ var _a, _b, _c, _d, _e, _f;
37
38
  if (config.pluginId == null)
38
39
  config.pluginId = "genericAuthPlugin";
39
40
  var endpoints = [];
@@ -69,6 +70,14 @@ var GetManagementModule = function (config) {
69
70
  },
70
71
  handler: GetManagementUserByUserid,
71
72
  });
73
+ endpoints.push({
74
+ routeProps: {
75
+ path: "/:userid/view",
76
+ method: flink_1.HttpMethod.get,
77
+ origin: config.pluginId,
78
+ },
79
+ handler: GetUserViewByUserid,
80
+ });
72
81
  endpoints.push({
73
82
  routeProps: {
74
83
  path: "/:userid",
@@ -127,10 +136,13 @@ var GetManagementModule = function (config) {
127
136
  if (((_c = config.uiSettings) === null || _c === void 0 ? void 0 : _c.enableUserEdit) == true) {
128
137
  features.push("edit");
129
138
  }
139
+ if (((_d = config.uiSettings) === null || _d === void 0 ? void 0 : _d.enableUserView) == true) {
140
+ features.push("view");
141
+ }
130
142
  var module = {
131
143
  id: config.pluginId || "user",
132
144
  uiSettings: {
133
- title: ((_d = config.uiSettings) === null || _d === void 0 ? void 0 : _d.title) || "Users",
145
+ title: ((_e = config.uiSettings) === null || _e === void 0 ? void 0 : _e.title) || "Users",
134
146
  icon: "",
135
147
  features: features,
136
148
  },
@@ -138,8 +150,9 @@ var GetManagementModule = function (config) {
138
150
  type: management_api_plugin_1.ManagementApiType.user,
139
151
  endpoints: endpoints,
140
152
  data: {
141
- profileSchema: config.profileSchema
142
- }
153
+ profileSchema: config.profileSchema,
154
+ userViewGetData: (_f = config.userView) === null || _f === void 0 ? void 0 : _f.getData,
155
+ },
143
156
  };
144
157
  return module;
145
158
  };
@@ -0,0 +1,2 @@
1
+ export interface GetManagementUserViewByUseridReq {
2
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface GetManagementUserViewByUseridRes {
2
+ buttons: {
3
+ text: string;
4
+ url: string;
5
+ }[];
6
+ data: {
7
+ [key: string]: string;
8
+ };
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/generic-auth-plugin",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "description": "Flink plugin that provides a generic user authentification solution.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\"",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@flink-app/email-plugin": "^0.3.0",
20
20
  "@flink-app/jwt-auth-plugin": "^0.3.0",
21
- "@flink-app/management-api-plugin": "^0.3.0",
21
+ "@flink-app/management-api-plugin": "^0.3.3",
22
22
  "handlebars": "^4.7.7",
23
23
  "jsonwebtoken": "^8.5.1"
24
24
  },
@@ -29,5 +29,5 @@
29
29
  "ts-node": "^9.1.1",
30
30
  "typescript": "^4.2.4"
31
31
  },
32
- "gitHead": "21b4a23ed4d3eea816c38271bd37b5aa9d91cd5b"
32
+ "gitHead": "31ca42f9020b2cfbc3ecbb7308d683135b35b49e"
33
33
  }
package/readme.md CHANGED
@@ -578,6 +578,7 @@ const genericAuthManagementModule = GetManagementModule(
578
578
  enableUserEdit, : true //Make it possible to edit the user
579
579
  enableUserCreate, : true //Make it possible to create new users
580
580
  enableUserDelete, : true //Make it possible to delete the user
581
+ enableUserView, : true //Make it possible to view a user
581
582
  }
582
583
  }
583
584
  )
@@ -612,6 +613,60 @@ function start() {
612
613
  }
613
614
  ```
614
615
 
616
+ ### Enable user viewing
617
+
618
+ To make it possible to view data for a user, you will need to first enable the `enableUserView` flag.
619
+
620
+ You can also provide a function that returns the data that should be shown of the user.
621
+ This function can also be extended to return a list of buttons that will be added to the toolbar.
622
+
623
+
624
+ ```
625
+ import { GetManagementModule } from "@flink-app/generic-auth-plugin"
626
+
627
+ const genericAuthManagementModule = GetManagementModule(
628
+ {
629
+ ui : true, //Enable UI for this module in flink-admin-portal
630
+ uiSettings : {
631
+ title : "App users", //Title of this module
632
+ enableUserEdit, : true //Make it possible to edit the user
633
+ enableUserCreate, : true //Make it possible to create new users
634
+ enableUserDelete, : true //Make it possible to delete the user
635
+ enableUserView, : true //Make it possible to view a user
636
+ },
637
+ userView: {
638
+ getData(user: User) {
639
+
640
+ let data: {
641
+ [key: string]: string
642
+ } = {
643
+ 'E-mail': user.username,
644
+ 'Profile property' : user.profile.Property.toString()
645
+ }
646
+
647
+ let buttons: {
648
+ text: string
649
+ url: string
650
+ }[] = []
651
+
652
+ buttons.push({
653
+ text: 'Visit google',
654
+ url: 'https://www.google.com',
655
+ })
656
+
657
+
658
+ return {
659
+ buttons,
660
+ data,
661
+ }
662
+ },
663
+ },
664
+ }
665
+ )
666
+ ```
667
+
668
+
669
+
615
670
  ### Make it possible to edit profile properites
616
671
 
617
672
  To make it possible to edit profile properties when editing users, you must expose the JSON-schema of the profile.